Skip to content

Instantly share code, notes, and snippets.

@zeitounator
Created October 27, 2025 13:15
Show Gist options
  • Select an option

  • Save zeitounator/7dfda9e906ccca9f1a22feaa6de6b2c5 to your computer and use it in GitHub Desktop.

Select an option

Save zeitounator/7dfda9e906ccca9f1a22feaa6de6b2c5 to your computer and use it in GitHub Desktop.
$ pwd
/tmp/reproSo
$ tree -p
[drwxr-xr-x] .
├── [-rw-r--r--] ansible.cfg
└── [drwxr-xr-x] inventory
├── [-rw-r--r--] hosts
└── [-rw-r--r--] webservers.ini
2 directories, 3 files
$ ansible --version
ansible [core 2.19.2]
config file = /tmp/reproSo/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/.pyenv/versions/3.13.5/lib/python3.13/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /home/user/.pyenv/versions/3.13.5/bin/ansible
python version = 3.13.5 (main, Jul 18 2025, 10:43:01) [GCC 11.4.0] (/home/user/.pyenv/versions/3.13.5/bin/python3.13)
jinja version = 3.1.6
pyyaml version = 6.0.2 (with libyaml v0.2.5)
$ cat ansible.cfg
[defaults]
inventory=/tmp/reproSo/inventory
$ for i in inventory/*; do echo -e "$i\n-------"; cat $i; echo; done
inventory/hosts
-------
[web]
10.0.0.35
inventory/webservers.ini
-------
[web]
web1 ansible_host=10.0.0.1
web2 ansible_host=10.0.0.2
$ ansible-inventory --list
{
"_meta": {
"hostvars": {
"web1": {
"ansible_host": "10.0.0.1"
},
"web2": {
"ansible_host": "10.0.0.2"
}
},
"profile": "inventory_legacy"
},
"all": {
"children": [
"ungrouped",
"web"
]
},
"web": {
"hosts": [
"10.0.0.35",
"web1",
"web2"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment