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