Skip to content

Instantly share code, notes, and snippets.

@ujwalkomarla
Last active March 28, 2019 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ujwalkomarla/ccd8d6d577ed601b67a5e3cd1e0efe26 to your computer and use it in GitHub Desktop.
Save ujwalkomarla/ccd8d6d577ed601b67a5e3cd1e0efe26 to your computer and use it in GitHub Desktop.
Sample EXOS HTTPAPI Ansible Playbook
R_SW1 ansible_host=10.68.5.64 ansible_network_os=exos ansible_connection=httpapi ansible_user=admin ansible_ssh_pass=""
---
- name: Basic Configuration
hosts: R_SW1
gather_facts: true
tasks:
- name: Collect facts
exos_facts:
gather_subset: all
- name: run show version on remote devices
exos_command:
commands: show version
- name: run show version and check to see if output contains ExtremeXOS
exos_command:
commands: show version
wait_for: result[0] contains ExtremeXOS
- name: run multiple commands on remote nodes
exos_command:
commands:
- show version
- show ports
- name: run multiple commands and evaluate the output
exos_command:
commands:
- show version
- show ports
wait_for:
- result[0] contains ExtremeXOS
- result[1] contains 20
- name: run command that requires answering a prompt
exos_command:
commands:
- command: 'clear license-info'
prompt: 'Are you sure.*'
answer: 'Yes'
- name: configure SNMP system name
exos_config:
lines: configure snmp sysName "{{ inventory_hostname }}"
- name: configure interface settings
exos_config:
lines:
- configure ports 2:2 description-string MasterUplink
backup: yes
- name: check the startup-config against the running-config
exos_config:
diff_against: startup
diff_ignore_lines:
- ntp clock .*
- name: save running to startup when modified
exos_config:
save_when: modified
register: testout
- name: dump test output
debug:
msg: '{{ testout }}'
- name: Create vlan
exos_vlan:
vlan_id: 100
name: test-vlan
state: present
- name: Testing the VLAN module
exos_vlan:
aggregate:
- {vlan_id: '500', name: ansible_500, interfaces: ['1:1','2:1']}
- {vlan_id: '1600', name: ansible_1600, interfaces: ['1:4']}
purge: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment