You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you append this to the inventory.proxmox.yaml file:
groups:
k3s_cluster: "'k3s' in (proxmox_tags_parsed|list)"master: "'k3s-master' in (proxmox_tags_parsed|list)"node: "'k3s-nodes' in (proxmox_tags_parsed|list)"
(Yes I separated my provisioned master and nodes for easier management as IaC)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Dynamic Inventory Provisioning
Just wanted to share that I have provisioned my cluster with a Proxmox dynamic inventory
Thought it might be of interest.
You can include "tags" on your qemu guests through either the Ansible community.general.proxmox_kvm module or through the Terraform Telmate/Proxmox provider; I chose the latter.
Then you simply create a file called
blah.proxmox.yaml
(I called mineinventory.proxmox.yaml
) and we can start querying for those tags we used!Dynamic Inventory Config
Rendering Dynamic Hosts
When I run
ansible-inventory -i inventory.proxmox.yaml --graph
I get back something like:Here is where it gets interesting ....
Creating Dynamic Groups to Tie into this Repo
If you append this to the
inventory.proxmox.yaml
file:(Yes I separated my provisioned master and nodes for easier management as IaC)
Then we can get back from our
ansible-inventory
:Deploy to N Number of Hosts
Back to this repo, you can run the magic command:
What this will do is create that dynamic inventory from Proxmox and the tags and blast away creating everything for you!
Caveats
...-e @...
commandansible_host:
parameter in theinventory.proxmox.yaml
fileproxmox_agent_interfaces | selectattr('name','equalto','ens18')|map(attribute='ip-addresses')|first)[0] | ipaddr('address')
ens18
was my interface nameansible-inventory -i inventory.proxmox.yaml --host blah
to see all labels from that hostP.S.
I don't care that a static inventory is "easier".
This transfers to other cloud providers and scaled much better
Beta Was this translation helpful? Give feedback.
All reactions