Ansible dynamic inventory

Hi @all,

i have developed a dynamic inventory plugin for lxd and looking for testers. The plugin is available on github and i will start cleanup and refactoring in the coming days.

The following filters for groups are currently implemented:
- location: no idea if it works, i grabbed examples from bugreports -> need sample
- pattern: e.g. samba * or regex
- network_range: e.g. or fd42: bd00: 7b11: 2167: 216: 3eff :: / 24
- os: e.g. ubuntu
- release: e.g. groovy
- profile: e.g. default
- vlanid: e.g. 666

plugin path: plugins/inventory/
testdata: plugins/inventory/test/lxd_inventory.atd
ansible config: plugins/inventory/test/

For testing, the following structure must be created, i use symlinks:

inventory_plugins/ -> …/…/ansible-collections/plugins/inventory/
inventory_plugins/test -> …/…/ansible-collections/plugins/inventory/test/
lxd.yml -> …/ansible-collections/plugins/inventory/test/lxd.yml

The test is started by the following command:
$ ansible-inventory -i lxd.yml --playbook-dir ./ --list

In the ansible config: “plugins/inventory/test/” is by default “selftest: True”, to start a realworld test, please set it to False and adjust the config according to your needs.

Should it fail, please create a dump “dumpdata: true” and upload the file “lxd_data- .atd” and the config.

I am currently primarily interested in the results of the test with clusters and a “location” and “vlanid”.

Greetings Frank

1 Like

Oh, that sounds quite interesting!