https://github.com/wilfriedroset/consul-awx
Inventory script for AWX with Consul as datasource
https://github.com/wilfriedroset/consul-awx
ansible ansible-inventory-script awx consul
Last synced: 7 months ago
JSON representation
Inventory script for AWX with Consul as datasource
- Host: GitHub
- URL: https://github.com/wilfriedroset/consul-awx
- Owner: wilfriedroset
- License: mit
- Created: 2020-03-29T12:27:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-13T19:21:16.000Z (9 months ago)
- Last Synced: 2025-03-19T05:42:33.800Z (7 months ago)
- Topics: ansible, ansible-inventory-script, awx, consul
- Language: Python
- Size: 90.8 KB
- Stars: 11
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Consul inventory source for AWX/Tower
[](https://travis-ci.org/wilfriedroset/consul-awx)Aims to provide an inventory script for
[AWX/Tower](https://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html)
as first target but also usable by vanilla Ansible with Consul catalog as data
source.Standalone Ansible inventory scripts can rely on INI configuration file where
AWX/Tower rely only on environment variables. All data are pulled from the catalog
API.## Usage
### AWX
Simply add this script as inventory within AWX/Tower following the [official
documentation](https://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html).### Standalone Ansible
Following [Working with dynamic inventory](https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html) documentation, the simplest method to use this script as inventory is the implicit method:```
wget https://raw.githubusercontent.com/wilfriedroset/consul-awx/master/consul_awx.py -o /etc/ansible/hosts
chmod +x /etc/ansible/hosts
# Configure it
cat << EOF > /etc/ansible/consul_awx.ini
[consul]
host: 127.0.0.1
port: 8500
scheme: http
verify: true
EOF
# Test it
/etc/ansible/hosts --list
```## Credits
This script was mostly inspired by [consul_io.py](https://github.com/ansible/ansible/tree/devel/contrib/inventory)