telekom-mms/ansible-collection-icinga-director

inventory - how to map host vars to ansible vars

zatroa opened this issue · 4 comments

doing a
ansible-inventory -v --list -i icinga_director_inventory.yml
I see

{
"_meta": {
"hostvars": {
"host1.tld": {
"accept_config": true,
"address": "host1.tld",
"has_agent": true,
"imports": [
"generic_host_tpl"
],
"master_should_connect": true,
"object_name": "host1.tld",
"object_type": "object",
"vars": {
"ssh_port": "2222"
}
},
...

My question is how to map the "vars.ssh_port" to "ansible_port" ?

I would be fine to do this by adding

compose:
ansible_port: vars.ssh_port`

to the "icinga_director_inventory.yml" file.

I'll need to check that. :)

I got a working (fo rme at least) implementation in the branch "compose_keyed_groups" here: https://github.com/T-Systems-MMS/ansible-collection-icinga-director/tree/compose_keyed_groups

Can you please test it?

I'd also like to create some integration-tests for the inventory-module, but feel free to use the current implementation. :)

I have tested. It works.

Thank you a lot for your fast help. Let your great work going on. :-)

closed by #155