Last active
June 18, 2021 07:50
-
-
Save halberom/e7791aa22c7dd1ef3f1ece3c815b4af8 to your computer and use it in GitHub Desktop.
ansible - testing constructed inventory plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[inventory] | |
enable_plugins = ini, constructed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugin: constructed | |
strict: False | |
keyed_groups: | |
- prefix: foo | |
key: foo|default('none') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host1 | |
host2 foo=bar | |
host3 foo=foo | |
host4 | |
host5 foo=foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ansible host5 -i hosts -i dynamic.config -m debug -a 'var=groups' | |
host5 | SUCCESS => { | |
"changed": false, | |
"groups": { | |
"all": [ | |
"host1", | |
"host2", | |
"host3", | |
"host4", | |
"host5" | |
], | |
"foo_bar": [ | |
"host2" | |
], | |
"foo_foo": [ | |
"host5", | |
"host3" | |
], | |
"foo_none": [ | |
"host4", | |
"host1" | |
], | |
"ungrouped": [ | |
"host1", | |
"host2", | |
"host3", | |
"host4", | |
"host5" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment