...
picos_config Ansible module manages configurations on devices running PICOS. picos_config Ansible module software is included in AmpCon Server software version 1.4 and later.
Table of Contents |
---|
picos_config Module Benefits
picos_config Ansible module software has the following benefits:
- Only configure the set commands that are not present in the switch or the ones that need to be changed.
- Ability to compare the difference between input configuration file and actual configuration present in the switch.
- Show configurations and other switch information.
picos_config Module Usage Examples
Here are several usage examples for picos_config module when using Ansible to run single task/module:
- Set Configuration Commands Example
ansible leaf_switches -m picos_config -a "mode='cli_config' cmd='set interface gigabit-ethernet ge-1/1/1 mtu 1500’” - Show Configuration Commands Example
ansible leaf_switches -m picos_config -a "mode='cli_show' cmd='show running-config interface gigabit-ethernet ge-1/1/1 | display set'"
ansible leaf_switches -m picos_config -a "mode='cli_show' cmd='show running-config | display set’” - Example for Executing a Command in Linux
- License information
ansible leaf_switches -m picos_config -a "mode='shell' cmd='license -s'" - Hard drive utilization
ansible leaf_switches -m picos_config -a "mode='shell' cmd='df -h'" - System uptime
ansible leaf_switches -m picos_config -a "mode='shell' cmd='uptime’” - Example for Setting Configuration Commands From an Input File
ansible leaf_switches -m picos_config -a "mode='config_load' cmd='/home/admin/setconf1.config'"
picos_config Ansible Module Example Playbooks
A collection of simple Ansible Playbooks to configure and verify PICOS can be download here PICOSExamplePlaybooks.zip.
...
(3) Playbooks that use configuration text file.
Executing Simple Playbook With or Without Variables
Let us take the show_switch_port.yml playbook example. It prints switch host name and port number to which a specific MAC address endpoint is connected. Following is the playbook code:
...
1. Select the Automation>Playbooks menu, and click +Playbooks as shown below:
2. Enter name of the playbook and description as shown below and click Please note: Name of the playbook field need to be less than 20 characters and no spaces. Description field need to be less than 40 characters.
3. Make sure playbook.yml is highlighted. Cut and paste the following example playbook show_switch_port.yml provided in the window as shown below. Click Save All.
4. Click Run as shown below.
5. Select the switch or group of switches for running the playbook as shown below and click Next.
6. Enter name of the variable and its value in JSON format shown below and click Next. Otherwise if your Playbook does not have any variable, then simply click Next.
7. Click Run Playbook as shown below.
8. To check playbook execution result, select the Automation > Job list menu, and click Task Results as shown below for the playbook you just executed.
Click Show Result as shown below to see the output of playbook execution:
Executing Playbooks That Use Configuration Text File
Let us take the conf_snmpv3.yml playbook example. It copies the snmpv3.conf file containing SNMPv3 configuration to the switch, and then loads the configuration. Following is the playbook code:
...
3. Select the Automation>Playbooks menu, and click Import as shown below:
Enter the Playbook Name and Description as shown below. Upload the Zip File and click Import.
4. Click Run as shown below.
Select the switch or group of switches for running the playbook as shown below and click Next two times.
Click Run Playbook as shown below.
5. To check playbook execution result, select the Automation>Job list menu, and click Task Results as shown below for the playbook you just executed.
Click Show Result as shown below.
SNMPv3 configured commands are shown below.