Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avinash6784/ansible-dynamic-inventory-mysql
Ansible dynamic inventory for MySQL with Python Script
https://github.com/avinash6784/ansible-dynamic-inventory-mysql
ansible ansible-inventory dynamic-inventory mariadb mysql pyhton
Last synced: about 2 months ago
JSON representation
Ansible dynamic inventory for MySQL with Python Script
- Host: GitHub
- URL: https://github.com/avinash6784/ansible-dynamic-inventory-mysql
- Owner: avinash6784
- Created: 2018-01-11T10:28:56.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-11T11:37:04.000Z (about 7 years ago)
- Last Synced: 2024-01-14T17:27:50.856Z (about 1 year ago)
- Topics: ansible, ansible-inventory, dynamic-inventory, mariadb, mysql, pyhton
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 7
- Watchers: 1
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Ansible dynamic inventory for MySQL with Python Script - ansible-dynamic-inventory-mysql
Ansible dynamic inventory for MySQL with Python Script. Here I have created test dynamic inventory script with python to get data from MySQL and Ansible will use it as an inventory source as long as it returns a JSON structure with the --list option.## Usage
Simply call the script like the following```yml
ansible-playbook -i dynamic_inventory.py example_playbook.yml
# or
ansible -i dynamic_inventory.py group_name -m ping
```
Python script run and its sample json output
```shell
./dynamic_inventory.py --listoutput ---
{
"all": ["localdb", "local", "localhost"],
"REDHAT": ["local", "localhost"],
"WINDOWS": ["localdb"],
"app": ["localhost"],
"db": ["localdb", "local", "localhost"]
}
```
## Author InformationsThis python script was created by [Avinash Pawar](http://devopstechie.com).