Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.28 KB

README.md

File metadata and controls

47 lines (33 loc) · 1.28 KB

ini_inventory

Ansible dynamic inventory script which reads standard Ansible inventory file and turns it into JSON inventory.

Motivation

The purpose of this script is to be able to combine output of multiple inventory scripts. Because inventory scripts are outputting JSON, an inventory script converting standard Ansible inventory file written in INI format was needed.

Usage

For example if we want to combine YAML inventory with the inventory file generated by Vagrand Ansible provisioner, we have to create inventory_scripts directory and place the inventory scripts in the correct order there:

$ mkdir inventory_scripts tools
$ git clone https://github.com/jtyr/ansible-ini_inventory tools/ini_inventory
$ git clone https://github.com/jtyr/ansible-yaml_inventory tools/yaml_inventory
$ ln -s tools/yaml_inventory/yaml_inventory.py inventory_scripts/1_yaml_inventory.py
$ ln -s tools/ini_inventory/ini_inventory.py inventory_scripts/2_ini_inventory.py
$ export INI_INVENTORY_FILENAME=./.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
$ ansible-playbook -i inventory_scripts site.yaml

License

MIT

Author

Jiri Tyr