Re: [ansible-project] Question on using Ansible to upgrade Linux with config file overwrites

2018-11-05 Thread Dick Visser
On Mon, 5 Nov 2018 at 18:33, EspressoBeanies  wrote:
>
> What's the best way to use Ansible to manage software updates where installer 
> config files have the potential to overwrite the config settings you 
> currently have in place? I'm trying to see if there's a way for Ansible to 
> apply software upgrades on all my *NIX machines but notify me when it runs 
> into packages that require config file replacements so that I can take a look 
> at the changes and see how best to apply my current settings to meet the new 
> ones. Curious to see if anyone found an effective workaround to this problem.

Hi

The idea behind using Ansible is that you want to make sure a system
is configured the way you want it.
This works best if you use it to configure more (ideally, all) aspects
of a system.
Basically Ansible (or any other configuration management tool) is
designed to make sure you don't end up in the situation you're in.
That said, it can of course be used to bring existing systems closer
back to what you want, but as you already know hand crafted systems
can contain quite a lot of configuration drift.
You also seem to be looking for some sort of interactivity when
upgrading. What you describe is exactly how upgrades work in the
Debian based distros.

But really you should be looking at spending effort on ansible
playbooks that carefully set up configuration files the way you need
them.
If you do this right, it will cost you less work. Also you should
consider redeploying systems onto a new version of the base OS, rather
than upgrading them. IMHO upgrading an OS introduces a lot of subtle
configuration drift.

Dick

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOA8ewQijmcHdvE-zd3v2b%2BxjUg0Eit2OzJp5BwGh6GAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ftp - ansible

2018-11-05 Thread Dick Visser
Sounds like just the copy module would work.


On Mon, 5 Nov 2018 at 15:26, nadim mansour  wrote:

> I have files that I need to transfer from my mac (machine) to windows
> server and linux server before running several tasks
> files are binary files and .exe
>
> can the files be sent through ftp ? can someone help please
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5cee66b8-4510-4726-a777-383b66e8190d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwP7A%3DYpJB1GiY7nihVfiC%3DHuD920o9Lpw0OOThaVF8ezA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Regexp failure: Unmatched group

2018-11-05 Thread John Harmon


> If you that is the only place you have phy: replace module would be a lot 
> easier. 
>
>   - replace: 
>   path: /path/to/file 
>   regexp: (, )?'phy:[^']+' 
>   replace: '' 
>
>
> -- 
> Kai Stian Olstad 
>
>
>
Yep, you are right.  That is much easier.  I'll go that route.  Out of 
curiosity do you think it is a syntax issue with my hodgepodge of groups 
causing the "unmatched group" error? or a bug?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/db00e104-1da5-493c-bed3-e77a260f8723%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Restart kestrelservice

2018-11-05 Thread Nk Chitturi
Thank you all, I am able to run my first playbook successfully.

Thanks,
Narmada

On Saturday, November 3, 2018 at 3:32:32 AM UTC-7, Dick Visser wrote:
>
> The whole point of the systemd module (or any other module, really) is to 
> abstract commands away, so don’t have to use them.
> Try out the examples and enjoy!
>
> Dick
>
>
> On Fri, 2 Nov 2018 at 19:39, Nk Chitturi > 
> wrote:
>
>> Brian, I am very new to anisble but in the link you provided i can see 
>> some examples with systemd, it has state mentioned, but how can i use 
>> command to restart the service
>>
>> - name: restart service cron on centos, in all cases, also issue 
>> daemon-reload to pick up config changes
>>   systemd:
>> state: restarted
>> daemon_reload: yes
>> name: crond
>>
>>
>> On Fri, Nov 2, 2018 at 11:34 AM Brian Coca > > wrote:
>>
>>> See docs for correct syntax
>>> https://docs.ansible.com/ansible/latest/modules/systemd_module.html
>>>
>>> -- 
>>> --
>>> Brian Coca
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to ansible-proje...@googlegroups.com .
>>> To post to this group, send email to ansible...@googlegroups.com 
>>> .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/CACVha7fSY2NAmSoNTJg9ohOL8RGvLJjhdr2z83Ae6hxCExd1Kw%40mail.gmail.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> -- 
>>  
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CABdF8S0uppa%2Bti%2B44jHtMVO5GUJsJ8yjtqn-%3DTz8r1f0LUPmJw%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Sent from a mobile device - please excuse the brevity, spelling and 
> punctuation.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/100da1ab-b1ab-4f91-b0fa-2e1e8399e9fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Regexp failure: Unmatched group

2018-11-05 Thread Kai Stian Olstad
On Monday, 5 November 2018 22:28:29 CET John Harmon wrote:
> 
> > So you have a regexp that isn't working, but haven't told us what you are 
> > trying to do, so it's actually impossible to help you. 
> >
> In the link I provided there is a sample string.  I capture 6 different 
> groups.  In short, I am trying to remove all phy devices strings from the 
> line.  From my line, you can see I am trying to only retain groups 1,2,3 
> and 6.  When complete, I should have a new "disk = ['file ]" string 
> that only contains devices being referenced by a file instead of a physical 
> device.

If you that is the only place you have phy: replace module would be a lot 
easier.

  - replace:
  path: /path/to/file
  regexp: (, )?'phy:[^']+'
  replace: ''


-- 
Kai Stian Olstad


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2688507.Au3ss2TuV3%40x1.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] gcp_compute plugin showing auth failure

2018-11-05 Thread Murali Krishna
SUMMARY 

I am using gcp_compute plugin as a inventory source. While on local machine 
it is working fine but when I try to use this same inventory on GCP VM it 
is showing

ansible-inventory -i ./inventory/gcompute.gcp.yaml --graph 

[WARNING]: * Failed to parse /inventory/gcompute.gcp.yaml with gcp_compute 
plugin: Service Acccount Email only works with Machine Account-based 
authentication 



can somebody tell me how to resolve this

Thanks


ISSUE TYPE 
   
   - Bug Report

COMPONENT NAME 

gcp_compute plug-in
ANSIBLE VERSION 

ansible 2.5.5
CONFIGURATION 

ansible.cfg

[inventory]
enable_plugins = gcp_compute, host_list, script, yaml, ini, auto
OS / ENVIRONMENT 

GCP VM

OS: Linux
EXPECTED RESULTS 

expected to show all the hosts in gcp projects. failing with machine based 
authentication error

@ansible-inventory
@gcp_compute
@ansiblegalaxy 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3c493149-d9b1-400b-a114-fe163ad519c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Regexp failure: Unmatched group

2018-11-05 Thread John Harmon


> So you have a regexp that isn't working, but haven't told us what you are 
> trying to do, so it's actually impossible to help you. 
>
>
> -- 
> Kai Stian Olstad 
>
>
> In the link I provided there is a sample string.  I capture 6 different 
groups.  In short, I am trying to remove all phy devices strings from the 
line.  From my line, you can see I am trying to only retain groups 1,2,3 
and 6.  When complete, I should have a new "disk = ['file ]" string 
that only contains devices being referenced by a file instead of a physical 
device.

My apologies that I wasn't more clear.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2add645e-0a68-43fd-9621-aca7237e3a95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Regexp failure: Unmatched group

2018-11-05 Thread Kai Stian Olstad
On Monday, 5 November 2018 21:56:31 CET John Harmon wrote:
> I am getting a failure with the latter half of my task.  I replaced the 
> working stuff with 
> According to a regexp tester, every group does have something, and I don't 
> have empty groups.  https://regex101.com/r/MNkwaD/1
> I changed stdout_callback to minimal, but it didn't look much different.
> I am so new to regexp I could use another pair of eyes.  I don't know what 
> else to look for here.
> 
> Code:
> - name: Sanitize vm.cfg step 2 of 2
>   lineinfile:
> path: "{{ file }}"
> regexp: "{{ item.regexp }}"
> line: "{{ item.line }}"
> backrefs: "{{ item.backrefs }}"
>   with_items:
> 
> - regexp: (^disk\W+\[)?('file:[^']+'(,)?)?('phy:[^']+'(,)?)?(])?
>   line: \1\2\3\6
>   backrefs: yes

So you have a regexp that isn't working, but haven't told us what you are 
trying to do, so it's actually impossible to help you. 


-- 
Kai Stian Olstad


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1791376.8l22RkcSsc%40x1.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: HTTPConnectionpool(host = 'proxyhost' , port = 9480) , read timed out = 30 error on ansible 2.7.0 , remote node = windows server 2008

2018-11-05 Thread Jordan Borean
Looks like you are trying to connect through a proxy? The winrm connection 
plugin doesn't allow you to explicitly define a proxy in the inventory so 
it would need to be set in the environment variables using the 
http_proxy/http_proxy env vars. You can use the newer psrp connection 
plugin to define a proxy in Ansible like;

[windows]
windows-server

[windows:vars]
ansible_username=username
ansible_pass=pass
ansible_connection=psrp
ansible_psrp_proxy=proxyhost:9480

There are some other variables that you can set like 
'ansible_psrp_cert_validation' but have a look at the docs for more info 
https://docs.ansible.com/ansible/latest/plugins/connection/psrp.html.

Thanks

Jordan

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cd2d5f4f-09ae-434b-8dd0-c95e3b2936ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: windows - ansible.. create user and run remaining tasks with the user created

2018-11-05 Thread Jordan Borean
Using become is what you need, you shouldn't have to worry about creating 
the profile as become will do that for you when it first logs on as that 
user. You just need to make sure you don't manually create that profile 
before becoming that user as Windows will then create the profile at a 
different path.

Thanks

Jordan

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/084f6e96-1dab-495e-950e-513fda3f89c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Regexp failure: Unmatched group

2018-11-05 Thread John Harmon
I am getting a failure with the latter half of my task.  I replaced the 
working stuff with 
According to a regexp tester, every group does have something, and I don't 
have empty groups.  https://regex101.com/r/MNkwaD/1
I changed stdout_callback to minimal, but it didn't look much different.
I am so new to regexp I could use another pair of eyes.  I don't know what 
else to look for here.

Code:
- name: Sanitize vm.cfg step 2 of 2
  lineinfile:
path: "{{ file }}"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
backrefs: "{{ item.backrefs }}"
  with_items:

- regexp: (^disk\W+\[)?('file:[^']+'(,)?)?('phy:[^']+'(,)?)?(])?
  line: \1\2\3\6
  backrefs: yes

Failure:
failed: [ovmftp] (item={u'regexp': u
"(^disk\\W+\\[)?('file:[^']+'(,)?)?('phy:[^']+'(,)?)?(])?", u'line': u
'\\1\\2\\3\\6\\5\\4', u'backrefs': True}) => {"changed": false, "item": {
"backrefs": true, "line": "\\1\\2\\3\\6\\5\\4", "regexp": 
"(^disk\\W+\\[)?('file:[^']+'(,)?)?('phy:[^']+'(,)?)?(])?"}, "module_stderr"
: "tput: No value for $TERM and no -T specified\ntput: No value for $TERM 
and no -T specified\nTraceback (most recent call last):\n  File 
\"\", line 113, in \n  File \"\", line 105, in 
_ansiballz_main\n  File \"\", line 48, in invoke_module\n  File 
\"/tmp/ansible_lineinfile_payload_Wm2J_Z/__main__.py\", line 520, in 
\n  File \"/tmp/ansible_lineinfile_payload_Wm2J_Z/__main__.py\", 
line 511, in main\n  File 
\"/tmp/ansible_lineinfile_payload_Wm2J_Z/__main__.py\", line 300, in 
present\n  File \"/usr/lib64/python2.7/re.py\", line 266, in _expand\n   
 return sre_parse.expand_template(template, match)\n  File 
\"/usr/lib64/python2.7/sre_parse.py\", line 800, in expand_template\n   
 raise error, \"unmatched group\"\nsre_constants.error: unmatched group\n", 
"module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the 
exact error", "rc": 1}


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/295a6e4e-124c-43a4-b73d-4221bfaa0e6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-05 Thread Dick Visser
On Mon, 5 Nov 2018 at 16:59, visar  wrote:
>
> Hello kai,
>
> This is the xml file , where i want to enable Ldap user registry and disable 
> basic local registry using ansible

Your XML file actually has multiple include locations, so you'd have
to loop through them.
Since this is the case, you also need to make sure there are no
additional include locations.
Something like this should do the trick:



  vars:
locations:
  - conf/ldapUserRegistry.xml
  - conf/application.xml

  tasks:
  - name: Ensure locations are configured
xml:
  path: server.xml
  xpath: "/server/include[{{ i + 1 }}]"
  attribute: location
  value: "{{ item }}"
loop: "{{ locations }}"
loop_control:
  index_var: i

  - name: Ensure no other locations are configured
xml:
  path: server.xml
  xpath: "/server/include[position()>{{ (locations | length) }}]"
  state: absent





--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
T: +31205304488
PGP key fingerprint: F575 58C6 62C6 FD5B A9CD 217C 2667 13D4 E6EF 488D
GÉANT Vereniging (Association) is registered with the Chamber of
Commerce in Amsterdam with registration number 40535155 and operates
in the UK as a branch of GÉANT Vereniging. Registered office:
Hoekenrode 3, 1102 BR Amsterdam, The Netherlands. UK branch address:
City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOJ3apuTYFogOu5aOuNSYozWAwQC5uOdts78Ox%3Df-eqhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Manipulating part of a custom variable

2018-11-05 Thread John Harmon
Ah, it was the single quotes that I was missing.  Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/24c43af4-658c-444e-b50f-68a360b7daea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Manipulating part of a custom variable

2018-11-05 Thread Kai Stian Olstad
On Monday, 5 November 2018 18:53:55 CET John Harmon wrote:
> How can I throw in a custom string?  Everything I try seems to fail:
> 
> Working:
> newname: "{{ oldname.stdout ~ ansible_date_time.date }}"
> Returns:
> myserver2018-11-05
> 
> Desired:
> myserver-COPY-2018-11-05

newname: "{{ oldname.stdout ~ '-COPY-' ~ ansible_date_time.date }}"


-- 
Kai Stian Olstad


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3192671.d7IDuiEUtF%40x1.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Manipulating part of a custom variable

2018-11-05 Thread John Harmon
How can I throw in a custom string?  Everything I try seems to fail:

Working:
newname: "{{ oldname.stdout ~ ansible_date_time.date }}"
Returns:
myserver2018-11-05

Desired:
myserver-COPY-2018-11-05

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c299ccd2-074f-4ede-9672-d693ba447af9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Why doesn't Ansible like my regexp?

2018-11-05 Thread John Harmon
Thanks Kai!  That was the issue.  No complaints from Ansible now.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bfe6a803-86df-472c-a70d-1b909d14ba77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Why doesn't Ansible like my regexp?

2018-11-05 Thread Kai Stian Olstad
On Monday, 5 November 2018 18:13:39 CET John Harmon wrote:
> 
> As far as I can tell I have all of my quotes... it just doesn't seem to 
> like my escaping... Adding verbosity didn't give me any useful information.
> 
> 
>   - name: Sanitize vm.cfg step 2 of
>   lineinfile:
> path: "{{ file }}"
> regexp: "{{ item.regexp }}"
> line: "{{ item.line }}"
> backrefs: "{{ item.backrefs }}"
>   with_items:
> - { regexp: "^(vif.*'mac=)((\w{2}:){3})((\w{2}:?){3})(.+)'$", line: 
> "\1\2AA:{{ 
> 99 | random(start=10, step=1) }}:{{ 99 | random(start=10, step=1) }}\6": 
> backrefs: yes }
> - { regexp: "(^uuid)(?:[=\s']+)'(.*)'.*$", line: "{{ newid.stdout 
> }}", backrefs: no }
> - { regexp: "(^name)(?:[=\s']+)'(.*)'.*$", line: "{{ newid.stdout 
> }}", backrefs: no }
> 
> Result:
> ERROR! Syntax Error while loading YAML.
>   found unknown escape character

In my experience this is because of double quotes around regexp and line that 
contains backslash, it is treated as a string and do expand escapes.
You can avoid that by using single quotes instead, but then you need to escape 
the single quotes in you regexp.

What I do is avoid quotes all together, to do that you need to write your 
with_items in another style

  with_items:
- regexp: ^(vif.*'mac=)((\w{2}:){3})((\w{2}:?){3})(.+)'$
  line: \1\2AA:{{ 99 | random(start=10, step=1) }}:{{ 99 | random(start=10, 
step=1) }}\6
  backrefs: yes
- regexp: (^uuid)(?:[=\s']+)'(.*)'.*$
  line: "{{ newid.stdout }}"
  backrefs: no
- regexp: (^name)(?:[=\s']+)'(.*)'.*$
  line: "{{ newid.stdout }}"
  backrefs: no


This should work and the double quotes in the line must be there since { after 
colon in yaml is treated as a dict.

-- 
Kai Stian Olstad


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1873674.tdpmB0pa1K%40x1.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Question on using Ansible to upgrade Linux with config file overwrites

2018-11-05 Thread EspressoBeanies
What's the best way to use Ansible to manage software updates where 
installer config files have the potential to overwrite the config settings 
you currently have in place? I'm trying to see if there's a way for Ansible 
to apply software upgrades on all my *NIX machines but notify me when it 
runs into packages that require config file replacements so that I can take 
a look at the changes and see how best to apply my current settings to meet 
the new ones. Curious to see if anyone found an effective workaround to 
this problem.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/84ac1ee9-cb21-42b4-9d3d-40f127532810%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Why doesn't Ansible like my regexp?

2018-11-05 Thread John Harmon
 

As far as I can tell I have all of my quotes... it just doesn't seem to 
like my escaping... Adding verbosity didn't give me any useful information.


  - name: Sanitize vm.cfg step 2 of
  lineinfile:
path: "{{ file }}"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
backrefs: "{{ item.backrefs }}"
  with_items:
- { regexp: "^(vif.*'mac=)((\w{2}:){3})((\w{2}:?){3})(.+)'$", line: 
"\1\2AA:{{ 
99 | random(start=10, step=1) }}:{{ 99 | random(start=10, step=1) }}\6": 
backrefs: yes }
- { regexp: "(^uuid)(?:[=\s']+)'(.*)'.*$", line: "{{ newid.stdout 
}}", backrefs: no }
- { regexp: "(^name)(?:[=\s']+)'(.*)'.*$", line: "{{ newid.stdout 
}}", backrefs: no }

Result:
ERROR! Syntax Error while loading YAML.
  found unknown escape character

The error appears to have been in '/etc/ansible/playbooks/one-offs/test.yml'
: line 46, column 37, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  with_items:
- { regexp: "^(vif.*'mac=)((\w{2}:){3})((\w{2}:?){3})(.+)'$", line: 
"\1\2AA:{{ 
99 | random(start=10, step=1) }}:{{ 99 | random(start=10, step=1) }}\6": 
backrefs: yes }
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:

with_items:
  - {{ foo }}

Should be written as:

with_items:
  - "{{ foo }}"


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f9be92b0-81fc-401d-a99a-fd997b144c80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Is there any way to select a single host when using a pattern?

2018-11-05 Thread Brian Coca
put run_once at play level

-- 
--
Brian Coca

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7dmu-%3D4Pc28Eyv%3D2Dewj%2B3y-eSrQa2-keY-r19_WXCaNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-05 Thread visar
Hello kai,

This is the xml file , where i want to enable Ldap user registry and 
disable basic local registry using ansible







monitor-1.0
jsp-2.2
servlet-3.0
ssl-1.0
appSecurity-2.0
adminCenter-1.0





















ADMIN
JazzAdmins
vwjazzadmin



${server.config.dir}











On Monday, November 5, 2018 at 9:16:40 PM UTC+5:30, Dick Visser wrote:
>
> On Mon, 5 Nov 2018 at 15:45, visar > 
> wrote: 
> > 
> > Hello Kai, 
> > 
> > Thanks a lot for your gudance here. Its really appreciated. 
> > 
> > I am very new to ansible and thought like this is a normal task already 
> done by experts like you and was eager to get a reply on that.. 
> > 
> > Here i just gone through the xml module and couldnt dfind any 
> information to replace lines as we seen in the lineinfile module. Please 
> correct me if i missed any.. 
>
> Hi Visar 
>
> Correct. 
> The point I was trying to make is that using string manipulation to 
> edit an XML configuration file might not be the best way to go about 
> it. 
> A regular expression might work - until it doesn't. For instance when 
> the content is split over lines, uses inconsistent spacing, the regex 
> eats multiple instances which you didn't want, etc. 
> The XML module does not "replace lines" , but will operate on the 
> actual XML elements, which is more robust. 
>
> For this to work you need to know the structure of the XML  - can you 
> supply the server.xml? 
>
> Thanks 
>
> Dick 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/057d004f-515c-443e-9f83-fb5de7401db5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-05 Thread Dick Visser
On Mon, 5 Nov 2018 at 15:45, visar  wrote:
>
> Hello Kai,
>
> Thanks a lot for your gudance here. Its really appreciated.
>
> I am very new to ansible and thought like this is a normal task already done 
> by experts like you and was eager to get a reply on that..
>
> Here i just gone through the xml module and couldnt dfind any information to 
> replace lines as we seen in the lineinfile module. Please correct me if i 
> missed any..

Hi Visar

Correct.
The point I was trying to make is that using string manipulation to
edit an XML configuration file might not be the best way to go about
it.
A regular expression might work - until it doesn't. For instance when
the content is split over lines, uses inconsistent spacing, the regex
eats multiple instances which you didn't want, etc.
The XML module does not "replace lines" , but will operate on the
actual XML elements, which is more robust.

For this to work you need to know the structure of the XML  - can you
supply the server.xml?

Thanks

Dick

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNhxexVyqjiPAkwZgci-%2Bu6s3UX6mPtowFWYNyQx%3D7WTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Uwe Sauter
Ah, I missed that line.

Thanks.


Am 05.11.18 um 16:18 schrieb Kai Stian Olstad:
> On Monday, 5 November 2018 16:06:19 CET Uwe Sauter wrote:
>> As far as I can tell there is no such loop in the template:
> 
> It is, i just formatted it to show it more clearly. 
> 
> 
>> [root@awx02 mysql]# cat templates/my.cnf.j2
>> [mysqld]
>> datadir=/var/lib/mysql
>> socket=/var/lib/mysql/mysql.sock
>> user=mysql
>> binlog_format=ROW
>> bind-address="{{ ansible_default_ipv4.address }}"
>> default_storage_engine=innodb
>> innodb_autoinc_lock_mode=2
>> innodb_flush_log_at_trx_commit=0
>> innodb_buffer_pool_size=122M
>> wsrep_provider=/usr/lib64/galera-3/libgalera_smm.so
>> wsrep_provider_options="gcache.size=300M; gcache.page_size=300M"
>> wsrep_cluster_name="galera_cluster1"
>> wsrep_cluster_address="gcomm://{% for host in
>> groups['mysql']%}{{hostvars[host]['ansible_default_ipv4']['address']}}{%
>> if not loop.last %},{% endif %}{% endfor %}"
> 
> The loop is here.
> 
> 
>> wsrep_sst_method=rsync
>> server_id=1
>> wsrep_node_address="{{ ansible_default_ipv4.address }}"
>> wsrep_node_name="{{ ansible_hostname }}"
>> [mysql_safe]
>> log-error=/var/log/mysqld.log
>> pid-file=/var/run/mysqld/mysqld.pid
>>
>>
>> From which message did you get that loop in the template?
> 
> See above.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c517b71c-f9e0-7b87-9971-c3ed3fc3d195%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Kai Stian Olstad
On Monday, 5 November 2018 16:06:19 CET Uwe Sauter wrote:
> As far as I can tell there is no such loop in the template:

It is, i just formatted it to show it more clearly. 


> [root@awx02 mysql]# cat templates/my.cnf.j2
> [mysqld]
> datadir=/var/lib/mysql
> socket=/var/lib/mysql/mysql.sock
> user=mysql
> binlog_format=ROW
> bind-address="{{ ansible_default_ipv4.address }}"
> default_storage_engine=innodb
> innodb_autoinc_lock_mode=2
> innodb_flush_log_at_trx_commit=0
> innodb_buffer_pool_size=122M
> wsrep_provider=/usr/lib64/galera-3/libgalera_smm.so
> wsrep_provider_options="gcache.size=300M; gcache.page_size=300M"
> wsrep_cluster_name="galera_cluster1"
> wsrep_cluster_address="gcomm://{% for host in
> groups['mysql']%}{{hostvars[host]['ansible_default_ipv4']['address']}}{%
> if not loop.last %},{% endif %}{% endfor %}"

The loop is here.


> wsrep_sst_method=rsync
> server_id=1
> wsrep_node_address="{{ ansible_default_ipv4.address }}"
> wsrep_node_name="{{ ansible_hostname }}"
> [mysql_safe]
> log-error=/var/log/mysqld.log
> pid-file=/var/run/mysqld/mysqld.pid
> 
> 
> From which message did you get that loop in the template?

See above.


-- 
Kai Stian Olstad


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/10366158.fEHZZUNP4P%40x1.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Uwe Sauter
As far as I can tell there is no such loop in the template:


[root@awx02 mysql]# cat templates/my.cnf.j2
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
binlog_format=ROW
bind-address="{{ ansible_default_ipv4.address }}"
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=0
innodb_buffer_pool_size=122M
wsrep_provider=/usr/lib64/galera-3/libgalera_smm.so
wsrep_provider_options="gcache.size=300M; gcache.page_size=300M"
wsrep_cluster_name="galera_cluster1"
wsrep_cluster_address="gcomm://{% for host in
groups['mysql']%}{{hostvars[host]['ansible_default_ipv4']['address']}}{%
if not loop.last %},{% endif %}{% endfor %}"
wsrep_sst_method=rsync
server_id=1
wsrep_node_address="{{ ansible_default_ipv4.address }}"
wsrep_node_name="{{ ansible_hostname }}"
[mysql_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


>From which message did you get that loop in the template?




Am 05.11.18 um 15:51 schrieb Kai Stian Olstad:
> On Monday, 5 November 2018 15:38:51 CET Uwe Sauter wrote:
>> Sure, but the template will only be used for the one host and as such should 
>> not look for variables of other hosts, right?
> 
> It will look up the variable on all host in group mysql
> 
> This is the code in the template
> 
>   {% for host in groups['mysql']%}
>   {{hostvars[host]['ansible_default_ipv4']['address']}}{% if not loop.last 
> %},{% endif %}
>   {% endfor %}
> 
> In the inventory he has
>   [mysql]
>   mysql01
>   mysql02
>   mysql03
>   mysql04
> 
> In the first iteration host = mysql01 so he is running
>   {{ hostvars['mysql01']['ansible_default_ipv4']['address'] }}
> 
> But since gather fact has not been run this will get you the error undefined 
> variable.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1a75b5b6-1af6-682c-0be8-49af7174a5ca%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Kai Stian Olstad
On Monday, 5 November 2018 15:38:51 CET Uwe Sauter wrote:
> Sure, but the template will only be used for the one host and as such should 
> not look for variables of other hosts, right?

It will look up the variable on all host in group mysql

This is the code in the template

  {% for host in groups['mysql']%}
  {{hostvars[host]['ansible_default_ipv4']['address']}}{% if not loop.last 
%},{% endif %}
  {% endfor %}

In the inventory he has
  [mysql]
  mysql01
  mysql02
  mysql03
  mysql04

In the first iteration host = mysql01 so he is running
  {{ hostvars['mysql01']['ansible_default_ipv4']['address'] }}

But since gather fact has not been run this will get you the error undefined 
variable.


-- 
Kai Stian Olstad


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/140150938.1yJldNP92I%40x1.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-05 Thread visar
Hello Kai,

Thanks a lot for your gudance here. Its really appreciated.

I am very new to ansible and thought like this is a normal task already 
done by experts like you and was eager to get a reply on that.. 

Here i just gone through the xml module and couldnt dfind any information 
to replace lines as we seen in the lineinfile module. Please correct me if 
i missed any..

On Monday, November 5, 2018 at 7:26:25 PM UTC+5:30, Kai Stian Olstad wrote:
>
> On 05.11.2018 12:34, visar wrote: 
> > Hi Experts, 
> > 
> > Any suggestion here ? 
>
> People do work in different timezone and/or are busy so you cant expect 
> an answer one the hour. 
>
>
> > On Monday, November 5, 2018 at 11:51:17 AM UTC+5:30, visar wrote: 
> >> 
> >> My file content as below. 
> >> 
> >> 
> 
>  
>
> >> 
> >>  
> >>  -this i want to 
> >> comment 
> >>  
> >>   --- this line i want 
> >> to 
> >> uncomment 
> >> 
> >> 
> >> 
> __
>  
>
> >> 
>
> Note the / on the end. 
>
>
> >> 
> ---
>  
>
> >> 
> >> - name: enable LDAP 
> >>   hosts: localhost 
> >>   tasks: 
> >>- name: disbale basic user-registry 
> >>  lineinfile: 
> >>path: 
> >> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml 
> >>regexp: '^\s* >> location="conf/basicUserRegistry.xml">.*$' 
> >>line: ';' 
> >>backrefs: yes 
> >>  become: true 
> >> 
> >> 
> ---
>  
>
> >> --- 
> >> 
> >> - name: enable LDAP USER_REGISTRY 
> >>   hosts: localhost 
> >>   tasks: 
> >> lineinfile: 
> >>   dest: 
> >> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml 
> >>   regexp: '^(.*)(.*)$' 
> >>   line: ';' 
> >>   backrefs: yes 
>
> Both of you regexp is missing a / at the end 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2346f1a5-6624-4bdd-9fb6-4a206fb4519c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Uwe Sauter
Sure, but the template will only be used for the one host and as such should 
not look for variables of other hosts, right?


Am 05.11.18 um 15:18 schrieb Kai Stian Olstad:
> On 05.11.2018 15:08, Uwe Sauter wrote:
>> Because he was running the playbook with this commandline:
>>
>> ansible-playbook -i infra --limit mysql04 main.yml --tags "mysql" -vvv
> 
> There you have the problem.
> He has template code that read variable from all the host in group mysql and 
> running the command with limit.
> Because of limit the fact gathering will run on mysql04 and not the other 
> hosts in the group so the
> ['ansible_default_ipv4']['address'] will be undefined for all of them except 
> mysql04.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4e23a1db-47c4-f6c6-6407-f16369dd4e84%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ftp - ansible

2018-11-05 Thread nadim mansour
I have files that I need to transfer from my mac (machine) to windows 
server and linux server before running several tasks
files are binary files and .exe 

can the files be sent through ftp ? can someone help please

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5cee66b8-4510-4726-a777-383b66e8190d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Kai Stian Olstad

On 05.11.2018 15:08, Uwe Sauter wrote:

Because he was running the playbook with this commandline:

ansible-playbook -i infra --limit mysql04 main.yml --tags "mysql" -vvv


There you have the problem.
He has template code that read variable from all the host in group mysql 
and running the command with limit.
Because of limit the fact gathering will run on mysql04 and not the 
other hosts in the group so the ['ansible_default_ipv4']['address'] will 
be undefined for all of them except mysql04.


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/51eeda8f8e9b36a4ea7d268b81a59b8f%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Uwe Sauter
Because he was running the playbook with this commandline:

ansible-playbook -i infra --limit mysql04 main.yml --tags "mysql" -vvv


Am 05.11.18 um 15:06 schrieb Kai Stian Olstad:
> On 04.11.2018 23:50, Tom K. wrote:
>> Hey Uwe,
>>
>> I hear you and apologies.  Was trying to keep it from getting too messy
>> since the output is large.
>>
>> Link to file is
>> here:  http://microdevsys.com/ansible/ansible-vvv.out.txt.gz
>>
>> Just the same, in case you can't get to the file, here's the first 100
>> lines:
>>
>>
>> TASK [mysql : Print all variables for each remote device]
>> *
>> task path: /ansible/roles/mysql/tasks/variables.yml:21
>> ok: [mysql04] => {
> 
> Why do you think the errors is related to mysql04?
> 
> Your template you have this code
> 
>   {% for host in groups['mysql']%}
>   {{hostvars[host]['ansible_default_ipv4']['address']}}{% if not loop.last 
> %},{% endif %}
>   {% endfor %}
> 
> The host is looping over every host is the group mysql and getting the 
> ansible_default_ipv4, so anyone of them could be the culprit.
> So you need to check them all, the easiest way to do that would be:
> 
>   ansible mysql -m setup -a 'filter=ansible_default_ipv4'
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ed7da42e-673d-ae6e-360d-7f7fe698cde5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Kai Stian Olstad

On 04.11.2018 23:50, Tom K. wrote:

Hey Uwe,

I hear you and apologies.  Was trying to keep it from getting too messy
since the output is large.

Link to file is
here:  http://microdevsys.com/ansible/ansible-vvv.out.txt.gz

Just the same, in case you can't get to the file, here's the first 100
lines:


TASK [mysql : Print all variables for each remote device]
*
task path: /ansible/roles/mysql/tasks/variables.yml:21
ok: [mysql04] => {


Why do you think the errors is related to mysql04?

Your template you have this code

  {% for host in groups['mysql']%}
  {{hostvars[host]['ansible_default_ipv4']['address']}}{% if not 
loop.last %},{% endif %}

  {% endfor %}

The host is looping over every host is the group mysql and getting the 
ansible_default_ipv4, so anyone of them could be the culprit.

So you need to check them all, the easiest way to do that would be:

  ansible mysql -m setup -a 'filter=ansible_default_ipv4'

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8cd36ffef914477f541ad7d83a02d8a1%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-05 Thread Kai Stian Olstad

On 05.11.2018 12:34, visar wrote:

Hi Experts,

Any suggestion here ?


People do work in different timezone and/or are busy so you cant expect 
an answer one the hour.




On Monday, November 5, 2018 at 11:51:17 AM UTC+5:30, visar wrote:


My file content as below.




 -this i want to 
comment


  --- this line i want 
to

uncomment


__



Note the / on the end.



---

- name: enable LDAP
  hosts: localhost
  tasks:
   - name: disbale basic user-registry
 lineinfile:
   path:
/opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
   regexp: '^\s*location="conf/basicUserRegistry.xml">.*$'

   line: ';'
   backrefs: yes
 become: true

---
---

- name: enable LDAP USER_REGISTRY
  hosts: localhost
  tasks:
lineinfile:
  dest:
/opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
  regexp: '^(.*)(.*)$'
  line: ';'
  backrefs: yes


Both of you regexp is missing a / at the end


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b0c8cceb0653726463a7606547837e87%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-05 Thread Dick Visser
Hi

I would not use lineinfile and regular expressions to manipulate XML.
You might get it to work, but it will be very fragile.
Instead have a look at the xml module, which (if you can get it to
work) will be more robust:

https://docs.ansible.com/ansible/2.4/xml_module.html


Dick

On Mon, 5 Nov 2018 at 12:34, visar  wrote:
>
> Hi Experts,
>
> Any suggestion here ?
>
> On Monday, November 5, 2018 at 11:51:17 AM UTC+5:30, visar wrote:
>>
>> Hi Experts,
>>
>>
>> Please help me with your guidance here.
>>
>> I want to comment a line in one config file and need to uncomment the other 
>> lline using ansible.
>>
>> My file content as below.
>> 
>>
>>  
>>   -this i want to comment
>>  
>>--- this line i want to 
>> uncomment
>>
>> __
>>
>> I tried with the below play book and its not showing any error even though 
>> its not changing any changes to the file.
>>
>> ---
>>
>> - name: enable LDAP
>>   hosts: localhost
>>   tasks:
>>- name: disbale basic user-registry
>>  lineinfile:
>>path: 
>> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
>>regexp: '^\s*.*$'
>>line: ';'
>>backrefs: yes
>>  become: true
>> ---
>> ---
>>
>> - name: enable LDAP USER_REGISTRY
>>   hosts: localhost
>>   tasks:
>> lineinfile:
>>   dest: 
>> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
>>   regexp: '^(.*)(.*)$'
>>   line: ';'
>>   backrefs: yes
>>
>> _
>>
>>
>> Output:
>>
>>
>> PLAY [enable LDAP] 
>> **
>>
>> TASK [Gathering Facts] 
>> **
>> ok: [localhost]
>>
>> TASK [disbale basic user-registry] 
>> **
>> ok: [localhost]
>>
>> PLAY RECAP 
>> **
>> localhost  : ok=2changed=0unreachable=0failed=0
>>
>>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/0f7ae057-ba2d-44e1-aaba-29b802acfca7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwP3FbU-FL6%3DYJ_PgYOeTz65DLTn4hQBEVTjLTF0k8_uYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Copy multiple files to different locations on remote server

2018-11-05 Thread Keshipeddy Anusha
Could someone please help me in writing shell commands

On Fri, Nov 2, 2018, 5:07 PM Keshipeddy Anusha  I am trying with below playbook and getting errors
>
> ---
> - hosts: all
>   tasks:
>   - name : replacing files
> Command:
>  args:
>  src: /tmp/file1
>   dest: /temp
>
>
> On Fri, Nov 2, 2018, 4:10 PM Mohan L 
>> Oh! yeah. I missed that part.
>>
>> On Friday, November 2, 2018 at 3:55:23 PM UTC+5:30, Frank Thommen wrote:
>>>
>>> This is not the same:
>>>
>>>* copy module copies from the controller (where you run the
>>>  ansible-playbook command) to the client
>>>* cp -f copies a file locally from client to itself
>>>
>>> frank
>>>
>>>
>>>
>>> On 11/02/2018 10:25 AM, Mohan L wrote:
>>> > Try with command or shell module with cp -f.
>>> >
>>> > On Friday, November 2, 2018 at 2:21:33 PM UTC+5:30, Keshipeddy Anusha
>>> wrote:
>>> >
>>> > No change Mohan
>>> > It is not replacing the file
>>> >
>>> > On Fri, Nov 2, 2018, 2:20 PM Mohan L >> >  wrote:
>>> >
>>> > copy module with force yes automatically replace it. Otherwise
>>> > you may need to delete it before copy task.
>>> >
>>> > On Thursday, November 1, 2018 at 8:11:53 PM UTC+5:30,
>>> Keshipeddy
>>> > Anusha wrote:
>>> >
>>> > Okay got it. Is there any specific module that we can use
>>> to
>>> > replace a complete file in remote server?
>>> >
>>> > Thank you for your help.
>>> >
>>> > Thanks,
>>> > Anusha
>>> >
>>> > On Thu, Nov 1, 2018, 8:07 PM Mohan L >> wrote:
>>> >
>>> >
>>> > What is happening when you try to use force: yes?
>>> >
>>> > *force*
>>> > bool
>>> >
>>> >
>>> >   * *Choices:*no
>>> >   *
>>> > *yes* ←
>>> >
>>> >
>>> > the default is |yes|, which will replace the remote
>>> file
>>> > when contents are different than the source. If |no|,
>>> > the file will only be transferred if the destination
>>> > does not exist.
>>> >
>>> > aliases: thirsty
>>> >
>>> >
>>> > On Thursday, November 1, 2018 at 9:48:27 AM UTC+5:30,
>>> > Keshipeddy Anusha wrote:
>>> >
>>> > How to replace the existing file on remote server
>>> > should we use any specific module for that? I
>>> > tried using force=yes but it didn't work for me.
>>> >
>>> > On Tue, Oct 30, 2018, 5:30 PM <
>>> anushake...@gmail.com
>>> > wrote:
>>> >
>>> > Thank you Mohan that worked for me
>>> >
>>> > --
>>> > You received this message because you are
>>> > subscribed to the Google Groups "Ansible
>>> > Project" group.
>>> > To unsubscribe from this group and stop
>>> > receiving emails from it, send an email to
>>> > ansible-proje...@googlegroups.com.
>>> > To post to this group, send email to
>>> > ansible...@googlegroups.com.
>>> > To view this discussion on the web visit
>>> >
>>> https://groups.google.com/d/msgid/ansible-project/4950ba71-0f0d-4630-8c1c-475fc93f8fc2%40googlegroups.com
>>> > <
>>> https://groups.google.com/d/msgid/ansible-project/4950ba71-0f0d-4630-8c1c-475fc93f8fc2%40googlegroups.com>.
>>>
>>> > For more options, visit
>>> > https://groups.google.com/d/optout
>>> > .
>>> >
>>> > --
>>> > You received this message because you are subscribed
>>> to
>>> > the Google Groups "Ansible Project" group.
>>> > To unsubscribe from this group and stop receiving
>>> emails
>>> > from it, send an email to
>>> ansible-proje...@googlegroups.com.
>>> > To post to this group, send email to
>>> > ansible...@googlegroups.com.
>>> > To view this discussion on the web visit
>>> >
>>> https://groups.google.com/d/msgid/ansible-project/01ef6833-b052-43ff-881e-70ad14e427e6%40googlegroups.com
>>> > <
>>> https://groups.google.com/d/msgid/ansible-project/01ef6833-b052-43ff-881e-70ad14e427e6%40googlegroups.com?utm_medium=email_source=footer>.
>>>
>>> > For more options, visit
>>> > https://groups.google.com/d/optout
>>> > .
>>> >
>>> > --
>>> > You received this message because you are subscribed to the
>>> > Google Groups "Ansible Project" group.
>>> > To 

[ansible-project] Re: need to replace a line in config file

2018-11-05 Thread visar
Hi Experts,

Any suggestion here ?

On Monday, November 5, 2018 at 11:51:17 AM UTC+5:30, visar wrote:
>
> Hi Experts,
>
>
> Please help me with your guidance here.
>
> I want to comment a line in one config file and need to uncomment the 
> other lline using ansible.
>
> My file content as below. 
>
> 
>
>   
>  -this i want to comment 
>   
>   --- this line i want to 
> uncomment
>
>
> __
>
> I tried with the below play book and its not showing any error even though 
> its not changing any changes to the file.
>
>
> ---
>
> - name: enable LDAP
>   hosts: localhost
>   tasks:
>- name: disbale basic user-registry
>  lineinfile:
>path: 
> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
>regexp: '^\s*.*$'
>line: ';'
>backrefs: yes
>  become: true
>
> ---
> ---
>
> - name: enable LDAP USER_REGISTRY
>   hosts: localhost
>   tasks:
> lineinfile:
>   dest: 
> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
>   regexp: '^(.*)(.*)$'
>   line: ';'
>   backrefs: yes
>
>
> _
>
>
> Output:
>
>
> PLAY [enable LDAP] 
> **
>
> TASK [Gathering Facts] 
> **
> ok: [localhost]
>
> TASK [disbale basic user-registry] 
> **
> ok: [localhost]
>
> PLAY RECAP 
> **
> localhost  : ok=2changed=0unreachable=0failed=0
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0f7ae057-ba2d-44e1-aaba-29b802acfca7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] HTTPConnectionpool(host = 'proxyhost' , port = 9480) , read timed out = 30 error on ansible 2.7.0 , remote node = windows server 2008

2018-11-05 Thread sase kumar
Hi experts,

I'm basically trying to run ansible playbook or any adhoc task on windows 
node (prerequisite done)  when I execute its waiting for some time and then 
throwing me this error

plaintext: HTTPConnectionpool(host = 'proxyhost' , port = 9480) , read 
timed out = 30
unreachable: true

I dont any clue on what is happening and this goes for all windows machines

Can any one advice me what are the different troubleshoot we can do for 
this error?

Note - I defined all the required inputs for windows machine in inventory 
file like user,password,port,protocol(tried ntlm,basic etc) , connection)

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3858ea08-13b6-4bdc-b5e1-d66d57358fe3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.