read ansible yaml inventory, create droplets
Project description
dofaucet
tl;dr
Read YAML-formatted ansible inventory, create digitalocean droplets accordingly.
Neat tricks:
- creates DNS records for both internal and external droplet IPs
- adds ssh pubkeys to droplets (only keys already uploaded to DO)
- adds alls created droplets to a project so they're easy to identify
Example usage
Inventory
foo.yml
all:
vars:
do_ssh_key_names: ['my_key', 'my_friends_key']
dofaucet_dnsroot: example.com
do_project: test_webstack_ansible
do_image_slug: fedora-28-x64
foohosts:
vars:
do_tags: foohosts
hosts:
foo.infra.example.com
barhosts:
vars:
do_tags: barhosts
# the bar app needs more ram
do_size_slug: s-1vcpu-2gb
hosts:
bar.infra.example.com
dofaucet CLI
dofaucet --token 23234242 --project foo --inventory foo.yml
future ideas
Ansible is python3, so we could use the native ansible functionality to parse the inventory. Example code:
from ansible.parsing.dataloader import DataLoader
from ansible.vars.manager import VariableManager
from ansible.inventory.manager import InventoryManager
loader = DataLoader()
inventory = InventoryManager(loader=loader, sources='~/inventory.yml')
variable_manager = VariableManager(loader=loader, inventory=inventory)
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
dofaucet-0.0.2.tar.gz
(5.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dofaucet-0.0.2.tar.gz.
File metadata
- Download URL: dofaucet-0.0.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e2e068758ca57a9b663da73896a856ca7bd2b08dad882185e85021682ded736
|
|
| MD5 |
4f9fdec1ce9dfacd78968e41c99e9bf7
|
|
| BLAKE2b-256 |
6ccd63eb09ccfdf1994a320d3b029452a8adf13927cf22664dd7dccc76361e55
|
File details
Details for the file dofaucet-0.0.2-py3-none-any.whl.
File metadata
- Download URL: dofaucet-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
980a334b7ad0ba466f165f6a11a714165cf1b9fba6bdd053e9421a90d26edc0f
|
|
| MD5 |
60d6c94c3d90792f5def46d59b3d90e8
|
|
| BLAKE2b-256 |
3f8f348e97280f52b74c1fdc6b96f2ebf7f445d0be2da9580c13f765ec6d3b70
|