Skip to content

Commit

Permalink
Adding all new tested sample playbooks to git hub.
Browse files Browse the repository at this point in the history
  • Loading branch information
amuraleedhar committed Jun 26, 2018
1 parent 730396c commit d78fdb5
Show file tree
Hide file tree
Showing 40 changed files with 620 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cnos_backup_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to do configuration back up.
hosts: cnos_backup_sample
gather_facts: no
connection: local

roles:
- cnos_backup_sample
18 changes: 18 additions & 0 deletions cnos_backup_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_backup_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_backup_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos rcpath=/root/cnos_config/G8272-running-config.txt

#Use this in case its TFTP as tftpboot folder is the starting point for tftp
#10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos rcpath=/anil/G8272-running-config.txt

9 changes: 9 additions & 0 deletions cnos_bgp_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Common code to do some configurations
- name: Module to do bgp configurations
hosts: cnos_bgp_sample
gather_facts: no
connection: local

roles:
- cnos_bgp_sample

15 changes: 15 additions & 0 deletions cnos_bgp_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_bgp_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_bgp_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

33 changes: 33 additions & 0 deletions cnos_command_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
- hosts: cnos_command
gather_facts: no
connection: network_cli

vars:
limit_to: "*"
debug: false
# Run the tests within blocks allows the next module to be tested if the previous one fails.
# This is done to allow https://github.com/ansible/dci-partner-ansible/ to run the full set of tests.


tasks:
- set_fact:
test_failed: false
failed_modules: []
- block:
- include_role:
name: cnos_command
when: "limit_to in ['*', 'cnos_command']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'cnos_command' ]"
test_failed: true

###########
- debug: var=failed_modules
when: test_failed

- name: Has any previous test failed?
fail:
msg: "One or more tests failed, check log for details"
when: test_failed
15 changes: 15 additions & 0 deletions cnos_command_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_command_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_command]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

8 changes: 8 additions & 0 deletions cnos_conditional_command_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to do some configurations based on conditions
hosts: cnos_conditional_command_sample
gather_facts: no
connection: local

roles:
- cnos_conditional_command_sample
15 changes: 15 additions & 0 deletions cnos_conditional_command_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_conditional_command_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_conditional_command_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

8 changes: 8 additions & 0 deletions cnos_conditional_template_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to do some template configurations based on conditions
hosts: cnos_conditional_template_sample
gather_facts: no
connection: local

roles:
- cnos_conditional_template_sample
15 changes: 15 additions & 0 deletions cnos_conditional_template_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_conditional_template_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_conditional_template_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

34 changes: 34 additions & 0 deletions cnos_config_sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- hosts: cnos_config
gather_facts: no
connection: network_cli

vars:
limit_to: "*"
debug: false
# Run the tests within blocks allows the next module to be tested if the previous one fails.
# This is done to allow https://github.com/ansible/dci-partner-ansible/ to run the full set of tests.


tasks:
- set_fact:
test_failed: false
failed_modules: []
- block:
- include_role:
name: cnos_config
when: "limit_to in ['*', 'cnos_config']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'cnos_config' ]"
test_failed: true


###########
- debug: var=failed_modules
when: test_failed

- name: Has any previous test failed?
fail:
msg: "One or more tests failed, check log for details"
when: test_failed
15 changes: 15 additions & 0 deletions cnos_config_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_command_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_config]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

8 changes: 8 additions & 0 deletions cnos_ethernet_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to do Interface Ethernet configurations
hosts: cnos_ethernet_sample
gather_facts: no
connection: local

roles:
- cnos_ethernet_sample
15 changes: 15 additions & 0 deletions cnos_ethernet_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_ethernet_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_ethernet_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

34 changes: 34 additions & 0 deletions cnos_facts_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- hosts: cnos_facts
gather_facts: no
connection: network_cli

vars:
limit_to: "*"
debug: false
# Run the tests within blocks allows the next module to be tested if the previous one fails.
# This is done to allow https://github.com/ansible/dci-partner-ansible/ to run the full set of tests.


tasks:
- set_fact:
test_failed: false
failed_modules: []
- block:
- include_role:
name: cnos_facts
when: "limit_to in ['*', 'cnos_facts']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'cnos_facts' ]"
test_failed: true

###########
- debug: var=failed_modules
when: test_failed

- name: Has any previous test failed?
fail:
msg: "One or more tests failed, check log for details"
when: test_failed

15 changes: 15 additions & 0 deletions cnos_facts_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_facts_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_facts]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

8 changes: 8 additions & 0 deletions cnos_image_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to do Image download using various protocols
hosts: cnos_image_sample
gather_facts: no
connection: local

roles:
- cnos_image_sample
17 changes: 17 additions & 0 deletions cnos_image_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_image_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_image_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos imgpath=/root/cnos_images/G8272-10.1.0.112.img

#Use this in case its TFTP as tftpboot is the starting point for tftp
#10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos imgpath="/anil/G8272-10.2.0.34.img
8 changes: 8 additions & 0 deletions cnos_portchannel_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to do portchannel configurations
hosts: cnos_portchannel_sample
gather_facts: no
connection: local
roles:
- cnos_portchannel_sample

15 changes: 15 additions & 0 deletions cnos_portchannel_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_portchannel_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_portchannel_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

8 changes: 8 additions & 0 deletions cnos_rollback_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to do rollback of configurations from back up server.
hosts: cnos_rollback_sample
gather_facts: no
connection: local

roles:
- cnos_rollback_sample
18 changes: 18 additions & 0 deletions cnos_rollback_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_rollback_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_rollback_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos rcpath=/root/cnos_config/G8272-running-config.txt

#Use this in case its TFTP as tftpboot folder is the starting point for tftp
#10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos rcpath=/anil/G8272-running-config.txt

8 changes: 8 additions & 0 deletions cnos_save_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to do save configurations
hosts: cnos_save_sample
gather_facts: no
connection: local

roles:
- cnos_save_sample
15 changes: 15 additions & 0 deletions cnos_save_sample_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You have to paste this dummy information in /etc/ansible/hosts
# Notes:
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups
#
# In the /etc/ansible/hosts file u have to enter [cnos_save_sample] tag
# Following you should specify IP Adresses details
# Please change <username> and <password> with appropriate value for your switch.

[cnos_save_sample]
10.241.107.39 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos

8 changes: 8 additions & 0 deletions cnos_showrun_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Common code to do some configurations
- name: Module to show running configuration
hosts: cnos_showrun_sample
gather_facts: no
connection: local

roles:
- cnos_showrun_sample
Loading

0 comments on commit d78fdb5

Please sign in to comment.