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”)’