Hello,
I am running into an issue, this is simple playbook which tries to copy right config file based on Domain name, I tried executing below code snippet it’s skipping the non prod and executing prod, Not sure whats wrong here, can some one throw a light here.
`
-
name: Gathering facts locally at role level
setup:
filter: ansible_* -
set_fact:
domainName: “{{ ansible_fqdn.split(‘.’, 1)[1] }}” -
name: Display all variables/facts known for a host
debug:
var: domainName -
name: Copy the non prod config file
win_template:
src: nonprod.yaml.j2
dest: C:\ProgramData\program\file.yaml
newline_sequence: \n
when: ((domainName == “AD1”) or (domainName == “AD2”)) -
name: Copy the prod config file
win_template:
src: prod.yaml.j2
dest: C:\ProgramData\program\file.yaml
when: ((domainName != “AD1”) or (domainName != “AD2”))
`
Thanks and Regards
Raj