I am trying to create dynamic inventories using the constructed plugin, but I am facing an issue. I have to specify both the classic inventory with the hosts and the constructed inventory for it to work. Even if I use -i inventory/ with the directory containing both inventories, it doesn’t change anything.
inventory/constructed.yml
---
plugin: constructed
strict: true
groups:
bases: "'proxmox' in group_names"`
Result :
ansible-playbook -i inventory task/test.yml
PLAY [Display group names for each host] **************************************************************************************************************************
TASK [Show group names] *******************************************************************************************************************************************
ok: [proxmox-01] => {
“msg”: “Host proxmox-01 is in groups: [‘luke_skywalker’, ‘production’, ‘proxmox’, ‘star_wars’]”
just only on inventory :
ansible-playbook -i inventory/inventory.yml -i inventory/constructed.yml task/test.yml
PLAY [Display group names for each host] **************************************************************************************************************************
TASK [Show group names] *******************************************************************************************************************************************
ok: [proxmox-01] => {
"msg": "Host proxmox-01 is in groups: ['bases', 'luke_skywalker', 'production', 'proxmox', 'star_wars']"
Ansible.cfg :
`[defaults]
roles_path = ./roles:~/.ansible/roles:/usr/share/ansible/roles
collections_paths = ./collections:~/.ansible/collections:/usr/share/ansible/collections
[inventory]
enable_plugins = ini, constructed
`
I would like passe on inventory i know is possible, i read docs, its an error for me.
thanks for watching
i tried remove, rename constructed, nothing help me