I am using ansible 1.7.2 on RedHat Note that I am super happy that I was doing something somewhat innocuous; however, this did just make a large number of changes across 600+ hosts... not a very cool behavior... this did not exist in 1.5, which is the version from which i upgraded. thanks in advance...
relevant play: # roles/common/tasks/main.yml --- - name: Read hosts table variables include_vars: "hosts_{{ ansible_distribution }}.yml" tags: hosts - name: debug test debug: msg="Here is my hosts {{ hosts }}" tags: hosts - name: Copy hosts table copy: src={{ hosts }} dest={{ hosts_target }} owner=root group={{ hosts_group }} mode=0644 tags: hosts ## roles/common/vars/hosts_Redhat.yml --- hosts_target: /etc/hosts hosts_group: root ## roles/common/vars/hosts_Solaris.yml --- hosts_target: /etc/inet/hosts hosts_group: sys ### Correct configuration ( this is a solaris host ) [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "ls -ltr /etc/inet/hosts" -rw-r--r-- 1 root sys 444 Nov 6 21:22 /etc/inet/hosts [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "digest -a md5 /etc/inet/hosts" 93049f5cbfe5c796b82ff256e4cd5639 [root@padishah1 ansible]# md5sum roles/common/files/hosts/hosts.swdw43.scs.iwcs.net 93049f5cbfe5c796b82ff256e4cd5639 roles/common/files/hosts/hosts.swdw43.scs.iwcs.net ansible-playbook sdlw_block1.yml -i west --tags=hosts --limit="swdw43*" --check ____________________ < PLAY [sdlw_block1] > -------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || _________________ < GATHERING FACTS > ----------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] ___________________________________________ < TASK: common | Read hosts table variables > ------------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] ___________________________ < TASK: common | debug test > --------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] => { "msg": "Here is my hosts hosts/hosts.swdw43.scs.iwcs.net" } _________________________________ < TASK: common | Copy hosts table > --------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] ____________ < PLAY RECAP > ------------ \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || swdw43.scs.iwcs.net : ok=4 changed=0 unreachable=0 failed=0 ## Change the group to root [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "chown :root /etc/inet/hosts && ls -l /etc/inet/hosts" -rw-r--r-- 1 root root 444 Nov 6 21:22 /etc/inet/hosts ## Run the same play again -- note check is set!!! [root@padishah1 ansible]# ansible-playbook sdlw_block1.yml -i west --tags=hosts --limit="swdw43*" --check ____________________ < PLAY [sdlw_block1] > -------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || _________________ < GATHERING FACTS > ----------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] ___________________________________________ < TASK: common | Read hosts table variables > ------------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] ___________________________ < TASK: common | debug test > --------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] => { "msg": "Here is my hosts hosts/hosts.swdw43.scs.iwcs.net" } _________________________________ < TASK: common | Copy hosts table > --------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || changed: [swdw43.scs.iwcs.net] ____________ < PLAY RECAP > ------------ \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || swdw43.scs.iwcs.net : ok=4 changed=1 unreachable=0 failed=0 ## Yikes!!!! This can be shown with changing perms too, not just group; however, ## I can leave that exercise out of the thread. [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "ls -ltr /etc/inet/hosts" -rw-r--r-- 1 root sys 444 Nov 6 21:22 /etc/inet/hosts ## Now, modify the hosts so hosts is different AND change group [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "echo '# just a comment line' >> /etc/inet/hosts && ls -l /etc/inet/hosts" -rw-r--r-- 1 root sys 466 Nov 6 21:34 /etc/inet/hosts [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "chown :root /etc/inet/hosts && ls -l /etc/inet/hosts" -rw-r--r-- 1 root root 466 Nov 6 21:34 /etc/inet/hosts ## Run the play again w/ check still set [root@padishah1 ansible]# ansible-playbook sdlw_block1.yml -i west --tags=hosts --limit="swdw43*" --check ____________________ < PLAY [sdlw_block1] > -------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || _________________ < GATHERING FACTS > ----------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] ___________________________________________ < TASK: common | Read hosts table variables > ------------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] ___________________________ < TASK: common | debug test > --------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ok: [swdw43.scs.iwcs.net] => { "msg": "Here is my hosts hosts/hosts.swdw43.scs.iwcs.net" } _________________________________ < TASK: common | Copy hosts table > --------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || changed: [swdw43.scs.iwcs.net] ____________ < PLAY RECAP > ------------ \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || swdw43.scs.iwcs.net : ok=4 changed=1 unreachable=0 failed=0 ## Here the check flag works!!! [root@padishah1 ansible]# ssh swdw43.scs.iwcs.net "ls -l /etc/inet/hosts" -rw-r--r-- 1 root root 466 Nov 6 21:34 /etc/inet/hosts -- 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/b8789577-91d1-4475-86a9-7adaba5c4aef%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.