An ansible dynamic inventory for DigitalOcean
Project description
DigitalOcean inventory
An ansible dynamic inventory for DigitalOcean
Status
Source | Shields |
---|---|
Project | |
Raised |
Installation
pip install digitalocean_inventory
Usage
Export the project environment variables:
export DO_PROJECT=example
export DO_ENV=production
export DO_SSH_DIR=/Users/joel/.ssh/example
Export an access token:
export DO_ACCESS_TOKEN=<token>
The pacakges exposes the executable:
digitalocean-inventory --list
Tags and inventory metadata are compiled into the output:
{
"meta": {
"hostvars": {
"123.123.123.123": {
"ansible_python_interpreter": "/usr/bin/python3",
"ansible_ssh_extra_args": "-o StrictHostKeyChecking=no",
"ansible_ssh_private_key_file": "/Users/joel/.ssh/example/example-production-0"
}
}
},
"all": {
"hosts": [
"123.123.123.123"
],
"vars": {},
"children": {}
},
"production": {
"hosts": [
"123.123.123.123"
]
},
"manager": {
"hosts": [
"123.123.123.123"
]
}
}
The executable has support for host, list and debug flags:
usage: Digital ocean inventory [-h] [--host [HOST]] [--list [LIST]] [--debug [DEBUG]]
[--private-ips [PRIVATE_IPS]]
optional arguments:
--host [HOST]
--list [LIST]
--debug [DEBUG]
--private-ips [PRIVATE_IPS]
To use with the ansible-playbook cli:
inventory.py
:
#!/usr/bin/env python
from digitalocean_inventory import fetch
if __name__ == '__main__':
fetch()
ansible-playbook -i inventory.py <playbook>
Docs
Additional details are available in the Documentation.
Tests
Install dependencies:
pip install .[tests]
Run with pytest
pytest
Versioning
SemVer is used for versioning. For a list of versions available, see the tags on this repository.
Bump2version is used to version and tag changes. For example:
bump2version patch
Releases are made on every major change.
Author
- Joel Lefkowitz - Initial work - Joel Lefkowitz
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
None yet!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for digitalocean_inventory-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d00affdc74596259f56387a165f8b7df04065a0de0357220e5f5a8b308d73e3c |
|
MD5 | 7d9f0e7b9be5dad43e9eb08d74f6dae3 |
|
BLAKE2b-256 | 3d21c4d1fd9d181cfa20ad2b9d45c0e574bf8d9027f5022c167b81256cf4e209 |
Hashes for digitalocean_inventory-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6668d6b4d8b7b542dd7ba5e2774bca91bf5199fdd0e42b0571bf8cf479d88fe |
|
MD5 | 26b54a09ce80c388c171c77bd7b9cc6a |
|
BLAKE2b-256 | 2a1eef2ab95735c2c4ba13ac3441536c5fabbe6e327e30a3f4584a0f84673afb |