Hello there
already asked on IRC with no luck.
In Ansible It is possibile to pass a custom filename to validate=‘’ rather than %s? I need to validate a main conf file which is not the templated one.
While this works fine but is not the intended behavior because it validate only {{ icinga2_hosts_dir }}{{ hostvars[item][‘ansible_fqdn’] }}.conf :
- name: Copy Host Definitions
template: src=host_def.j2
dest={{ icinga2_hosts_dir }}{{ hostvars[item][‘ansible_fqdn’] }}.conf
owner=root
group=root
mode=0644
validate=‘/usr/sbin/icinga2 -C -c %s’
with_items: groups[“{{ hosts }}”]
notify: - reload icinga2
This is what I want instead but gives me an error:
- name: Copy Host Definitions
template: src=host_def.j2
dest={{ icinga2_hosts_dir }}{{ hostvars[item][‘ansible_fqdn’] }}.conf
owner=root
group=root
mode=0644
validate=‘/usr/sbin/icinga2 -C -c /etc/icinga2/icinga2.conf’
with_items: groups[“{{ hosts }}”]
notify: - reload icinga2
Error:
File “/root/.ansible/tmp/ansible-tmp-1402058068.06-202801895532086/copy”, line 207, in main
(rc,out,err) = module.run_command(validate % src)
TypeError: not all arguments converted during string formatting
Thank you.