Puppet Bolt handles inventories in a very flexible and powerful manner: you can combine static target definitions and different targets into a single inventory. For example, you can have an inventory which defines some static node names combined with the AWS inventory, or one that combines static nodes with the Vagrant inventory.
Puppet Bolt inventory plugins do their magic and then output what is essentially a static inventory generated dynamically. When dynamic inventory plugins do not work (as in my case) it can be challenging to figure out what is wrong, let alone how to fix it. However, there's is a very handy way to print out a static version of the entire inventory, including the dynamically created content:
$ bolt inventory show --detail
server:
name: server
uri: ssh://127.0.0.1:2222
alias: []
config:
transport: ssh
ssh:
batch-mode: true
cleanup: true
connect-timeout: 10
disconnect-timeout: 5
load-config: false
login-shell: bash
tty: false
host-key-check: false
private-key: "/home/john/bolt-vagrant-test/.vagrant/machines/server/virtualbox/private_key"
run-as: root
user: vagrant
vars: {}
features: []
facts: {}
plugin_hooks:
puppet_library:
plugin: puppet_agent
stop_service: true
groups:
- all
--- snip ---
You can pipe the output to a file and edit it the file make it work as a static inventory. The only changes I had to do is removal of the "groups" section and getting rid of the useless crap that came in in STDOUT. Once you have the static inventory you can change settings (e.g. for SSH) to figure out why things are not working as expected, pointing Bolt to the proper inventory file when testing, e.g.
$ bolt command run "date" -i test-inventory.yaml -t server
Once the static inventory works you can proceed to fixing the underlying problem in dynamic provider.