Skip to content

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

License

Notifications You must be signed in to change notification settings

jtyr/ansible-ini_inventory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages