Search code examples
ansiblesolaris

How to extend Ansible's setup module to gather more information?


On Solaris Ansible's setup module does not gather information about installed zones. How to extend the setup module to gather the output of zoneadm list -iv?


Solution

    1. create a script named /etc/ansible/facts.d/zoneadm.fact and gather whatever information you need there. This can be whatever you want (bash/python/etc).

    2. When you are done, echo it to stdout as json format.

    3. Deploy that script via ansible, make it executable

    4. Gather facts and notice that the new facts are present under ansible_local.zoneadm

    More infos can be found here