Just noticed an issue with ansible 1.4.1 trying to deploy a networking 
configuration for dhcp.  Will paste configs below with hostnames changed:



*Playbook:*

#playbook.yml

---

- hosts: "{{ dhcp_hosts }}"
  user: ansible
  sudo: yes

  roles:
        - /home/ansible/Ansible/roles/dhcp

  tasks:



     - name: Ensure that dhclient is installed first
       yum:  name=dhclient
             state=present
       tags: deploy

     - name: Restart the network
       service:   name=network
                  state=restarted
       tags:    network


*DHCP ROLE:*---

#Drop a network config for dhcp
#

   #Drop the /etc/sysconfig/network-script/ifcfg-eth0 template
   - name: Drop the ifcfg-eth0 script
     template:  src=/home/ansible/Ansible/templates/dhcp/ifcfg-eth0.j2
                dest=/etc/sysconfig/network-scripts/ifcfg-eth0
                owner=root
                group=root
                mode=0644
     tags:      deploy

   - name: Drop the /etc/dhclient-eth0.conf file
     copy:      src=/home/ansible/Ansible/files/dhcp/dhclient-eth0.conf
                dest=/etc/dhclient-eth0.conf
                owner=root
                group=root
                mode=0644
     tags:      deploy


When the above playbook and role are run without --check (even with 
--diff), it functions as expected.  The appropriate template is dropped as 
ifcfg-eth0.  Where it gets interesting is if you run the same code with 
"--check --diff":

TASK: [/home/ansible/Ansible/roles/dhcp | Drop the ifcfg-eth0 script] 
*********
--- before: /etc/sysconfig/network-scripts/ifcfg-eth0
+++ after: /home/ansible/Ansible/templates/dhcp/ifcfg-eth0.j2
@@ -1,5 +1,8 @@
 DEVICE=eth0
-HWADDR=*###REMOVED###*
+BOOTPROTO=dhcp
+USERCTL=no
 ONBOOT=yes
-BOOTPROTO=dhcp
-DHCP_HOSTNAME=*###REMOVED###*
+check_link_down() {
+ return 1;
+}
+DHCP_HOSTNAME=*###REMOVED###*

changed: [*###REMOVED###*]


It seems as though ansible implementation has the "src" and "dst" flags 
switched, only when run with a "--diff --check".  Has anyone else seen this 
behavior?  The --check and --diff are vital components of our testing to 
make sure we don't deploy incorrect configs to our production servers.


Also, I have ensured that there is not a .j2 file present on any target 
servers and have tested across 10 different servers.

Thanks,
Matt

-- 
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to