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.
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ac3c515a-4ec5-48be-bcf9-3496c15dd554%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.