Ansible Project: Network Security Audit 4 – Individual Device Commands

This is a test to get different commands added to different devices.
There are multiple methods to achieve this.
1. Use host_vars and set each var in the file. The task will pull the variables for the hosts. All need to be the same name
2. Set individual plays for set commands. This does make the playbook longer.

Playbook found in my GitHub

I will be using method 1 for this example. I have created the host_var directories in the inventory directory. Each host has a directory named the same as the name in the inventory.
In my case, they are IP addresses.

Inside the snmp.yaml files, I have set a variable that is then referenced in the task. This is snmp_location

When running the task, the snmp_location variable is referenced in snmp.yaml.
This will put the individual commands to the different routers.

Leave a Comment

Your email address will not be published. Required fields are marked *