Variables in dynamic inventory not working

Hi,
i ve setup an playbook with cli_command
I ve a static inventory

192.168.200.159 ansible_network_os=ios ansible_ssh_user=user ansible_connection=network_cli

everything is working as expected, and executed on a cisco switch

now i ve changed the inventory to dynamic netbox inventory


plugin: netbox.netbox.nb_inventory
validate_certs: False
config_context: True
compose:
ansible_network_os: ios
ansible_ssh_user: user
ansible_connection: network_cli

now i got this error when it tries to connect

“msg”: “Connection type ssh is not valid for this module”

it looks like that my variables are not used in dynamic invnetory
I ve tried to add the variables to ansible.cfg
and I ve tried to add the variables to netbox context

Maybe someone can point me the right direction

thanks

Using compose with strings needs a little bit more than just treating it as a regular ansible variable

As an example try using:

compose:
     ansible_network_os: "'ios'" 

You’ll need to do this for all of your compose vars.

1 Like

Thanks you very much

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.