Adding Netbox
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: get config for verification
|
||||
include_role:
|
||||
name: "{{ config_manager_role }}"
|
||||
vars:
|
||||
ansible_network_provider: "{{ cisco_ios_role }}"
|
||||
function: get
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- routing == false
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
- name: Include vars for load function tests
|
||||
include_vars:
|
||||
file: "{{ playbook_dir }}/../vars/load.yml"
|
||||
|
||||
- block:
|
||||
- name: cleanup device configs
|
||||
include_role:
|
||||
name: "{{ config_manager_role }}"
|
||||
vars:
|
||||
ansible_network_provider: "{{ cisco_ios_role }}"
|
||||
function: load
|
||||
config_manager_text: "{{ setup_configs }}"
|
||||
ios_config_rollback_enabled: false
|
||||
ignore_errors: true
|
||||
|
||||
- name: load config via text string
|
||||
include_role:
|
||||
name: "{{ config_manager_role }}"
|
||||
vars:
|
||||
ansible_network_provider: "{{ cisco_ios_role }}"
|
||||
function: load
|
||||
config_manager_text: "{{ config_text_valid }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'No changes were found' not in ios_config_diff.stdout"
|
||||
|
||||
- name: set config_manager_text with all valid config to induce change in running-config
|
||||
set_fact:
|
||||
config_valid: "{{lookup('file', config_files_path + '/csr01_config_valid.j2')}}"
|
||||
|
||||
- name: load valid configurations into device using config file
|
||||
include_role:
|
||||
name: "{{ config_manager_role }}"
|
||||
vars:
|
||||
ansible_network_provider: "{{ cisco_ios_role }}"
|
||||
function: load
|
||||
config_manager_text: "{{ config_valid }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'No changes were found' not in ios_config_diff.stdout"
|
||||
|
||||
- name: set config_manager_text from lookup of a file with few invalid configs to test rollback
|
||||
set_fact:
|
||||
config_with_errors: "{{lookup('file', config_files_path + '/csr01_config_error.j2')}}"
|
||||
|
||||
- block:
|
||||
- name: test rollback in case of wrong config using file
|
||||
include_role:
|
||||
name: "{{ config_manager_role }}"
|
||||
vars:
|
||||
ansible_network_provider: "{{ cisco_ios_role }}"
|
||||
function: load
|
||||
config_manager_text: "{{ config_with_errors }}"
|
||||
register: result
|
||||
rescue:
|
||||
- assert:
|
||||
that:
|
||||
- "'Rollback Done' in ios_rollback_results.stdout"
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- hosts: csr01
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Include vars
|
||||
include_vars:
|
||||
file: "{{ playbook_dir }}/../vars/default.yml"
|
||||
|
||||
- name: executing 'get' function tests
|
||||
include_tasks: get.yml
|
||||
|
||||
- name: executing 'load' function tests
|
||||
include_tasks: load.yml
|
||||
@@ -0,0 +1,5 @@
|
||||
no router ospf 10
|
||||
!
|
||||
router ospf 10
|
||||
network 14.1.1.0 0.0.0.255 area 1
|
||||
neighbor 13.1.1.0 0.0.0.255 area 1
|
||||
@@ -0,0 +1,5 @@
|
||||
no router ospf 10
|
||||
!
|
||||
router ospf 10
|
||||
network 14.1.1.0 0.0.0.255 area 1
|
||||
network 13.1.1.0 0.0.0.255 area 1
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
# Vars for test env of ansible-network.cisco_ios role
|
||||
|
||||
config_manager_role: "{{ playbook_dir }}/../../../../../ansible-network.config_manager"
|
||||
cisco_ios_role: "{{ playbook_dir }}/../../../../../ansible-network.cisco_ios"
|
||||
config_files_path: "{{ playbook_dir }}/../templates/"
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
# Vars specific to load test suite
|
||||
#
|
||||
|
||||
setup_configs: "no interface loopback 100 \n
|
||||
no router ospf 10 "
|
||||
|
||||
config_text_valid: "interface loopback 100 \n
|
||||
description configured by config_manager role"
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
|
||||
- import_playbook: config_manager/tasks/main.yml
|
||||
Reference in New Issue
Block a user