Is there any way I can use the wild cards or regex in when statements,


when: ansible_distribution_major_version|int == 6 or ansible_fqdn == 
"test[0-1][0-9].example.com"


I actually do not want to pass hostname of my server in vars section. Will 
this regex work with in conjunction with Ansible facts ? 


During my playbook execution time, it need to interpret my hostname of the 
server from fact ansible_fqdn.


Samole playbook,


hosts: localhost
tasks:
name: debug
debug:
msg: "passed"
when: "ansible_distribution_major_version|int == 6 or ansible_fqdn | 
regex_search('test[0-9][0-1]-[0-9][0-9].example.com')"

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5e822c65-ca1c-40d1-a7cb-85aa120ff77bo%40googlegroups.com.

Reply via email to