Right now I am trying to have a role execute a function if the condition is 
host a or b, and before that only complete the previous task if its not a 
or b.

The problem I am having with the below is that is never reads the second 
condition statement. Can someone tell me a better way to this vice creating 
a duplicate role and having one for physical and one for virtual. 


- name: Grab sys_id
  shell: hostname
  register: {{ sys_id }}

- name: change this file only for virtual nics on eth0     <--- this should 
run every time unless its a bare metal deployment is id'd by hostname, else 
skips to next task
  template: src=...... dest=..... 
  when: '(sys_id.stdout != "a" or sys_id.stdout != "b")'

- name: change this file only for bare metal on eth4  <--- this runs only 
when baremetal nic is detected by host id
  template: src=...... dest=..... 
  when: '(sys_id.stdout == "a" or sys_id.stdout == "b")'

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to