Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 8 days 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 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-09T21:13:48.000Z (3 months ago)
- Last Synced: 2024-08-09T22:27:43.520Z (3 months ago)
- Topics: ansible, ansible-inventory-script, awx, consul
- Language: Python
- Size: 83 KB
- Stars: 8
- Watchers: 3
- 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
[![Build Status](https://travis-ci.org/wilfriedroset/consul-awx.svg?branch=master)](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)