Using ansible to add host in icinga2 for automation

  • I want to configure icinga2 client server for automation using ansible. what I am planning on achieving this is to get the ticket for client server from master and store it in a variable and then run "icinga2 node wizard" command in client server and pass variables to it.


    First part, getting ticket from master and storing it for further use:


    Code
    1. - name: Registering ticket
    2. command: icinga2 pki ticket --cn 'clientserver'
    3. register: ticket
    4. delegate_to: icinga2masterserver


    then run command "icinga2 node wizard" and pass variables. I am thinking if this module can help.


    After this in master I will define object host using ansible.


    If there are other way to achieve this please mention. Thanks