I'm trying to write an Ansible playbook to set up Icinga2 nodes, but each host needs a unique ticket from the Icinga2 master to authenticate. Right now I'm thinking of ssh'ing out from the node to the master to grab the ticket, but that doesn't seem like a good idea. I also tried using Ansible's prompts, but I'm running the playbook from Ansible Tower, which apparently doesn't support that (it just hangs waiting for stdin).
Setting up icinga2 nodes via Ansible: how to get the ticket from the master
ansibleicinga
Best Answer
Ansible allows to get facts from other hosts with the
delegate_to
parameter.To grab the ticket from the icinga2 server you will need something like this:
This tasks will store the output of the
icinga2 pki ticket
command in theticket
variable. You might need to filter a bit to get only the ticket id. Take a look at Ansible examples repository for more information. You will also need to have the icinga2_server in youinventory
for the delegation.