# Conditional Statements help

**URL:** <https://forum.ansible.com/t/conditional-statements-help/29583>\
**Category:** Ansible Developer\
**Created:** [January 31, 2019, 8:34pm UTC](https://forum.ansible.com/t/conditional-statements-help/29583 "2019-01-31T20:34:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alan\_Harkleroad](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Alan\_Harkleroad](https://forum.ansible.com/u/Alan_Harkleroad)\
**Post date:** [January 31, 2019, 8:34pm UTC](https://forum.ansible.com/t/conditional-statements-help/29583/1 "2019-01-31T20:34:23Z")

</div>

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