Setting up a dynamic inventory
The chapter-09
directory also has a few dynamic inventory files we are going to use in this chapter. We are going to start with a stripped-down version to ensure the inventory and connectivity from Ansible to Nautobot are working as expected.
Let’s view the nautobot-inventory-01.yml
inventory file:
root@nautobot-dev:~/nautobot-book/chapter-09# cat nautobot-inventory-01.yml--- plugin: networktocode.nautobot.gql_inventory query: devices: name: root@nautobot-dev:~/nautobot-book/chapter-09#
This is a basic inventory file that will perform a GraphQL query to Nautobot only asking for device hostnames. This uses networktocode.nautobot.gql_inventory
, which we introduced in Chapter 8.
Let’s test it out using ansible-inventory
:
root@nautobot-dev:~/nautobot-book/chapter-09# ansible-inventory -i nautobot-inventory-01.yml --list{ "_meta": { &...