user1717259
user1717259

Reputation: 2863

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?

Upvotes: 14

Views: 21767

Answers (2)

user1717259
user1717259

Reputation: 2863

There is a converter written in python here.

https://github.com/appuio/ansible-ini2yaml

Upvotes: 1

user1717259
user1717259

Reputation: 2863

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.

Upvotes: 28

Related Questions