Search code examples
ansibleansible-inventoryansible-awx

How do you convert ansible ini inventory into json or yaml


Ansible AWX requires inventories to be entered in yaml or json format.

When you start learning ansible, you may take the choice to start off with your inventory in ini format.

https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html

Is it possible to convert between formats?


Solution

  • Example given here

    https://evrard.me/convert-ansible-inventories-with-ansible-inventory-cli

    ansible-inventory -i inventory.ini -y --list > inventory.yaml

    The -y flag gives yaml output. Omitting the flag gives json.