All Projects → AlanCoding → Ansible-inventory-file-examples

AlanCoding / Ansible-inventory-file-examples

Licence: MIT License
Examples and counter-examples of Ansible inventory files

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Ansible-inventory-file-examples

ansible-awx
Automatic installation for AWX (Ansible Tower Communiy) on Linux
Stars: ✭ 26 (+4%)
Mutual labels:  awx
ansible-nutanix-inventory
A dynamic inventory script for Ansible that interacts with the Nutanix API
Stars: ✭ 23 (-8%)
Mutual labels:  ansible-inventory
ansible-ssh
Script to connect to managed hosts using Ansible inventory and config.
Stars: ✭ 51 (+104%)
Mutual labels:  ansible-inventory
towerlib
A python library to interface with ansible tower's (awx) api.
Stars: ✭ 30 (+20%)
Mutual labels:  awx
ansible-yaml inventory
Ansible dynamic inventory reading the inventory from YAML file.
Stars: ✭ 19 (-24%)
Mutual labels:  ansible-inventory
ansible-dns-inventory
A dynamic inventory script for Ansible that uses DNS TXT records
Stars: ✭ 20 (-20%)
Mutual labels:  ansible-inventory
yaani
Yet another Ansible Netbox inventory
Stars: ✭ 12 (-52%)
Mutual labels:  ansible-inventory
simple-ansible-inventory
A simple, clean and easily readable Ansible inventory
Stars: ✭ 25 (+0%)
Mutual labels:  ansible-inventory
itop-utilities
Utilities scripts for itop, an open source cmdb. Empowers CMDB by connecting it to other system like Ansible.
Stars: ✭ 38 (+52%)
Mutual labels:  ansible-inventory
ansible-pull-example
example skeleton repo for setting up ansible-pull infrastructure
Stars: ✭ 22 (-12%)
Mutual labels:  ansible-inventory
Awx
AWX Project
Stars: ✭ 10,469 (+41776%)
Mutual labels:  awx

Ansible-inventory-file-examples

Examples and counter-examples of Ansible inventory files

Goals of these are mostly academic, to demonstrate a syntax, scaling pattern, or issue reproducer. None of these are designed to reflect best practices for using Ansible.

README files are given in many subdirectories.

Top level is mostly organized by file type, with further subdivisions by topic. While this isn't always maintained, an attempt is made.

Using these

Everything is designed to be ran from the CLI from the root of the project root. Aside from one folder for playbook, and other testing scripts, everything is an inventory file that goes in with the -i flag. That means you should see -i <relative path in project>. There are multiple testing commands you can use on any given inventory file.

# run the absolute minimal playbook
ansible-playbook -i top_level_file.ini debugging/hello_world.yml
# print the hostvars for all the hosts
ansible-playbook -i top_level_file.ini debugging/hostvars_print.yml
# dump standard representation of the inventory contents
ansible-inventory -i top_level_file.ini --list --export

Quick and dirty performance profiling

Reference for doing the cProfile stuff

ansible/ansible#13673

pip install pyprof2calltree
python -m cProfile -o outme $(which ansible-playbook) -i <rel_path> debugging/hello_world.yml
pyprof2calltree -i outme
qcachegrind outme.log

Commands from the root of project

Ansible config file example

Inventory plugin path via magic inventory_plugins dir:

ansible-inventory -i plugins/config_path/same_dir/cow.yaml --playbook-dir=plugins/config_path/same_dir --list

Inventory plugin path via child directories:

ansible-inventory -i plugins/config_path/sub_dir/cow.yaml --playbook-dir=plugins/config_path/sub_dir --list

Inventory plugin path via relative directory and using parent directories:

ansible-inventory -i plugins/config_path/inventory_dir/cow.yaml --playbook-dir=plugins/config_path/inventory_dir --list

All of these work testing locally.

Debugging process for the final example:

ansible-inventory -i plugins/config_path/inventory_dir/cow.yaml --playbook-dir=plugins/config_path/other_dir --list
ansible-doc -t inventory -l --playbook-dir=plugins/config_path/inventory_dir

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].