Swap how become is specified for ios integration tests (#34107)

This commit is contained in:
Nathaniel Case 2017-12-20 14:05:16 -05:00 committed by GitHub
parent 427479ae48
commit 5f215337c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 28 additions and 202 deletions

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -5,7 +5,7 @@
banner: login
state: absent
authorize: yes
become: yes
- name: Set login
ios_banner:
@ -16,7 +16,7 @@
string
state: present
authorize: yes
become: yes
register: result
- debug:
@ -36,7 +36,7 @@
string
state: present
authorize: yes
become: yes
register: result
- assert:

View file

@ -5,7 +5,7 @@
banner: motd
state: absent
authorize: yes
become: yes
- name: Set motd
ios_banner:
@ -16,7 +16,7 @@
string
state: present
authorize: yes
become: yes
register: result
- debug:
@ -36,7 +36,7 @@
string
state: present
authorize: yes
become: yes
register: result
- assert:

View file

@ -7,14 +7,12 @@
over multiple lines
state: present
authorize: yes
become: yes
- name: remove login
ios_banner:
banner: login
state: absent
authorize: yes
become: yes
register: result
- debug:
@ -30,7 +28,6 @@
banner: login
state: absent
authorize: yes
become: yes
register: result
- assert:

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -9,7 +9,6 @@
authorize: yes
wait_for:
- "result[0] contains 'Description: Foo'"
become: yes
register: result
ignore_errors: yes

View file

@ -10,7 +10,6 @@
wait_for:
- "result[0] contains Cisco"
- "result[1] contains Loopback888"
become: yes
register: result
- assert:

View file

@ -5,7 +5,6 @@
ios_command:
commands: show foo
authorize: yes
become: yes
register: result
ignore_errors: yes
@ -19,7 +18,6 @@
- show version
- show foo
authorize: yes
become: yes
register: result
ignore_errors: yes

View file

@ -6,7 +6,6 @@
commands:
- show version
authorize: yes
become: yes
register: result
- assert:
@ -20,7 +19,6 @@
- show version
- show interfaces
authorize: yes
become: yes
register: result
- assert:

View file

@ -8,7 +8,6 @@
authorize: yes
wait_for:
- "result[0] contains bad_value_string"
become: yes
register: result
ignore_errors: yes

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -10,7 +10,6 @@
- interface Loopback999
match: none
authorize: yes
become: yes
- name: collect any backup files
find:
@ -30,7 +29,6 @@
src: basic/config.j2
backup: yes
authorize: yes
become: yes
register: result
- assert:

View file

@ -10,14 +10,12 @@
- interface Loopback999
match: none
authorize: yes
become: yes
- name: configure device with defaults included
ios_config:
src: defaults/config.j2
defaults: yes
authorize: yes
become: yes
register: result
- debug: var=result
@ -33,7 +31,6 @@
src: defaults/config.j2
defaults: yes
authorize: yes
become: yes
register: result
- debug: var=result
@ -48,7 +45,6 @@
lines:
- mac-address-table notification mac-move
authorize: yes
become: yes
ignore_errors: yes
- name: show interfaces brief to ensure deivce goes to valid prompt
@ -56,7 +52,6 @@
commands:
- show interfaces
authorize: yes
become: yes
register: result
- assert:

View file

@ -10,14 +10,12 @@
- interface Loopback999
match: none
authorize: yes
become: yes
- name: save config
ios_config:
save: true
authorize: yes
become: yes
register: result
# FIXME https://github.com/ansible/ansible-modules-core/issues/5008
ignore_errors: true
@ -32,7 +30,6 @@
ios_config:
save: true
authorize: yes
become: yes
register: result
# FIXME https://github.com/ansible/ansible-modules-core/issues/5008
ignore_errors: true
@ -44,7 +41,6 @@
- "no ip http server"
save_when: modified
authorize: yes
become: yes
register: result
- name: save should always run
@ -54,7 +50,6 @@
- "ip http server"
save_when: modified
authorize: yes
become: yes
register: result
- assert:
@ -66,7 +61,6 @@
lines:
- "no ip http server"
authorize: yes
become: yes
register: result
- debug: msg="END cli/save.yaml on connection={{ ansible_connection }}"

View file

@ -10,13 +10,11 @@
- interface Loopback999
match: none
authorize: yes
become: yes
- name: configure device with config
ios_config:
src: basic/config.j2
authorize: yes
become: yes
register: result
- name: debug, remove me
@ -33,7 +31,6 @@
ios_config:
src: basic/config.j2
authorize: yes
become: yes
register: result
- assert:

View file

@ -7,7 +7,6 @@
ios_config:
src: basic/foobar.j2
authorize: yes
become: yes
register: result
ignore_errors: yes

View file

@ -10,14 +10,12 @@
- interface Loopback999
match: none
authorize: yes
become: yes
- name: configure device with config
ios_config:
src: basic/config.j2
match: none
authorize: yes
become: yes
register: result
- assert:
@ -31,7 +29,6 @@
ios_config:
src: basic/config.j2
authorize: yes
become: yes
register: result
- assert:

View file

@ -8,14 +8,12 @@
- 'no ip access-list standard test'
match: none
authorize: yes
become: yes
- name: configure sub level command
ios_config:
lines: ['permit ip any any log']
parents: ['ip access-list extended test']
authorize: yes
become: yes
register: result
- assert:
@ -29,7 +27,6 @@
lines: ['permit ip any any log']
parents: ['ip access-list extended test']
authorize: yes
become: yes
register: result
- assert:
@ -42,6 +39,5 @@
- 'no ip access-list extended test'
match: none
authorize: yes
become: yes
- debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}"

View file

@ -12,7 +12,6 @@
after: ['exit']
authorize: yes
match: none
become: yes
- name: configure sub level command using block resplace
ios_config:
@ -25,7 +24,6 @@
replace: block
after: ['exit']
authorize: yes
become: yes
register: result
- assert:
@ -48,7 +46,6 @@
replace: block
after: ['exit']
authorize: yes
become: yes
register: result
- assert:
@ -61,6 +58,5 @@
- no ip access-list extended test
match: none
authorize: yes
become: yes
- debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}"

View file

@ -14,7 +14,6 @@
after: exit
match: none
authorize: yes
become: yes
- name: configure sub level command using exact match
ios_config:
@ -28,7 +27,6 @@
after: exit
match: exact
authorize: yes
become: yes
register: result
- assert:
@ -51,7 +49,6 @@
parents: ip access-list extended test
match: exact
authorize: yes
become: yes
register: result
- assert:
@ -64,6 +61,5 @@
- no ip access-list extended test
match: none
authorize: yes
become: yes
- debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}"

View file

@ -13,7 +13,6 @@
before: no ip access-list extended test
match: none
authorize: yes
become: yes
- name: configure sub level command using strict match
ios_config:
@ -25,7 +24,6 @@
parents: ip access-list extended test
match: strict
authorize: yes
become: yes
register: result
- assert:
@ -42,7 +40,6 @@
after: exit
match: strict
authorize: yes
become: yes
register: result
- assert:
@ -60,6 +57,5 @@
lines: no ip access-list extended test
match: none
authorize: yes
become: yes
- debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}"

View file

@ -6,13 +6,11 @@
lines: ['hostname {{ shorter_hostname }}']
match: none
authorize: yes
become: yes
- name: configure top level command
ios_config:
lines: ['hostname foo']
authorize: yes
become: yes
register: result
- assert:
@ -24,7 +22,6 @@
ios_config:
lines: ['hostname foo']
authorize: yes
become: yes
register: result
- assert:
@ -36,6 +33,5 @@
lines: ['hostname {{ shorter_hostname }}']
match: none
authorize: yes
become: yes
- debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}"

View file

@ -8,14 +8,12 @@
- "hostname {{ shorter_hostname }}"
match: none
authorize: yes
become: yes
- name: configure top level command with before
ios_config:
lines: ['hostname foo']
after: ['snmp-server contact bar']
authorize: yes
become: yes
register: result
- assert:
@ -29,7 +27,6 @@
lines: ['hostname foo']
after: ['snmp-server contact foo']
authorize: yes
become: yes
register: result
- assert:
@ -43,6 +40,5 @@
- "hostname {{ shorter_hostname }}"
match: none
authorize: yes
become: yes
- debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}"

View file

@ -8,14 +8,12 @@
- "hostname {{ shorter_hostname }}"
match: none
authorize: yes
become: yes
- name: configure top level command with before
ios_config:
lines: ['hostname foo']
before: ['snmp-server contact bar']
authorize: yes
become: yes
register: result
- assert:
@ -29,7 +27,6 @@
lines: ['hostname foo']
before: ['snmp-server contact foo']
authorize: yes
become: yes
register: result
- assert:
@ -43,6 +40,5 @@
- "hostname {{ shorter_hostname }}"
match: none
authorize: yes
become: yes
- debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}"

View file

@ -6,14 +6,12 @@
lines: ['hostname {{ shorter_hostname }}']
match: none
authorize: yes
become: yes
- name: configure top level command
ios_config:
lines: ['hostname foo']
match: strict
authorize: yes
become: yes
register: result
- assert:
@ -26,7 +24,6 @@
lines: ['hostname foo']
match: strict
authorize: yes
become: yes
register: result
- assert:
@ -38,6 +35,5 @@
lines: ['hostname {{ shorter_hostname }}']
match: none
authorize: yes
become: yes
- debug: msg="END cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection }}"

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -7,7 +7,6 @@
gather_subset:
- all
authorize: yes
become: yes
register: result

View file

@ -5,7 +5,6 @@
- name: test getting default facts
ios_facts:
authorize: yes
become: yes
register: result
- assert:

View file

@ -7,7 +7,6 @@
gather_subset:
- "foobar"
authorize: yes
become: yes
register: result
ignore_errors: true
@ -31,7 +30,6 @@
- "!hardware"
- "hardware"
authorize: yes
become: yes
register: result
ignore_errors: true

View file

@ -7,7 +7,6 @@
gather_subset:
- "!hardware"
authorize: yes
become: yes
register: result
- assert:

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -5,7 +5,6 @@
ios_command:
commands: show version
authorize: yes
become: yes
register: show_version_result
- block:
@ -24,7 +23,6 @@
- no negotiation auto
parents: int GigabitEthernet2
authorize: yes
become: yes
- name: Set test interface 2 to GigabitEthernet3 as we are on Cisco IOS-XE
set_fact: test_interface2=GigabitEthernet3
@ -34,7 +32,6 @@
- no negotiation auto
parents: int GigabitEthernet3
authorize: yes
become: yes
when: "'Cisco IOS-XE' in show_version_result.stdout[0]"
- name: Configure interface (setup)
@ -45,7 +42,6 @@
mtu: 1800
state: present
authorize: yes
become: yes
register: result
- name: Configure interface
@ -54,7 +50,6 @@
description: test-interface-initial
state: present
authorize: yes
become: yes
register: result
- assert:
@ -69,7 +64,6 @@
description: test-interface-initial
state: present
authorize: yes
become: yes
register: result
- assert:
@ -83,7 +77,6 @@
mtu: 2000
state: present
authorize: yes
become: yes
register: result
- assert:
@ -100,7 +93,6 @@
mtu: 1800
state: present
authorize: yes
become: yes
register: result
- assert:
@ -115,7 +107,6 @@
name: "{{ test_interface }}"
enabled: False
authorize: yes
become: yes
register: result
- assert:
@ -129,7 +120,6 @@
name: "{{ test_interface }}"
enabled: True
authorize: yes
become: yes
register: result
- assert:
@ -146,7 +136,6 @@
mtu: 1800
state: present
authorize: yes
become: yes
register: result
- name: Add interface aggregate
@ -157,7 +146,6 @@
speed: 1000
state: present
authorize: yes
become: yes
register: result
- assert:
@ -177,7 +165,6 @@
speed: 1000
state: present
authorize: yes
become: yes
register: result
- assert:
@ -192,7 +179,6 @@
enabled: False
state: present
authorize: yes
become: yes
register: result
- assert:
@ -211,7 +197,6 @@
enabled: True
state: present
authorize: yes
become: yes
register: result
- assert:
@ -229,7 +214,6 @@
- name: Loopback10
state: absent
authorize: yes
become: yes
- name: Create loopback interface aggregate
ios_interface:
@ -238,7 +222,6 @@
- name: Loopback10
state: present
authorize: yes
become: yes
register: result
- assert:
@ -254,7 +237,6 @@
- name: Loopback10
state: absent
authorize: yes
become: yes
register: result
- assert:
@ -270,7 +252,6 @@
- name: Loopback10
state: absent
authorize: yes
become: yes
register: result
- assert:

View file

@ -5,7 +5,6 @@
ios_command:
commands: show version
authorize: yes
become: yes
register: show_version_result
- name: Set test interface to GigabitEthernet0/2 if we are on Cisco IOS
@ -24,7 +23,6 @@
tx_rate: ge(0)
rx_rate: ge(0)
authorize: yes
become: yes
register: result
- assert:
@ -38,7 +36,6 @@
tx_rate: gt(0)
rx_rate: lt(0)
authorize: yes
become: yes
ignore_errors: yes
register: result
@ -55,7 +52,6 @@
enabled: False
state: down
authorize: yes
become: yes
register: result
- assert:
@ -68,7 +64,6 @@
enabled: False
authorize: yes
state: up
become: yes
ignore_errors: yes
register: result
@ -82,7 +77,6 @@
commands:
- show lldp neighbors
authorize: yes
become: yes
register: show_lldp_neighbors_result
- block:
@ -93,7 +87,6 @@
- port: eth0
host: netdev
authorize: yes
become: yes
register: result
- assert:
@ -107,7 +100,6 @@
- port: dummy_port
host: dummy_host
authorize: yes
become: yes
ignore_errors: yes
register: result
@ -125,7 +117,6 @@
enabled: True
state: up
authorize: yes
become: yes
ignore_errors: yes
register: result
@ -142,7 +133,6 @@
- port: eth0
host: netdev
authorize: yes
become: yes
ignore_errors: yes
register: result
@ -160,7 +150,6 @@
- port: dummy_port
host: dummy_host
authorize: yes
become: yes
ignore_errors: yes
register: result

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -6,7 +6,6 @@
name: 172.16.0.1
state: absent
authorize: yes
become: yes
- name: Remove console
ios_logging:
@ -14,7 +13,6 @@
level: warnings
state: absent
authorize: yes
become: yes
- name: Remove buffer
ios_logging:
@ -22,7 +20,6 @@
size: 8000
authorize: yes
state: absent
become: yes
# start tests
- name: Set up host logging
@ -32,7 +29,6 @@
facility: local7
state: present
authorize: yes
become: yes
register: result
- assert:
@ -47,7 +43,6 @@
name: 172.16.0.1
state: present
authorize: yes
become: yes
register: result
- assert:
@ -60,7 +55,6 @@
name: 172.16.0.1
state: absent
authorize: yes
become: yes
register: result
- assert:
@ -74,7 +68,6 @@
name: 172.16.0.1
state: absent
authorize: yes
become: yes
register: result
- assert:
@ -87,7 +80,6 @@
level: warnings
state: present
authorize: yes
become: yes
register: result
- assert:
@ -100,7 +92,6 @@
dest: buffered
size: 8000
authorize: yes
become: yes
register: result
- assert:
@ -114,7 +105,6 @@
- { dest: console, level: notifications }
- { dest: buffered, size: 9000 }
authorize: yes
become: yes
register: result
- assert:
@ -130,7 +120,6 @@
- { dest: buffered, size: 9000 }
state: absent
authorize: yes
become: yes
register: result
- assert:

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -6,7 +6,6 @@
next_hop: 10.0.0.8
state: present
authorize: yes
become: yes
register: result
- assert:
@ -21,7 +20,6 @@
next_hop: 10.0.0.8
state: present
authorize: yes
become: yes
register: result
- assert:
@ -36,7 +34,6 @@
admin_distance: 2
state: present
authorize: yes
become: yes
register: result
- assert:
@ -52,7 +49,6 @@
admin_distance: 2
state: present
authorize: yes
become: yes
register: result
- assert:
@ -67,7 +63,6 @@
admin_distance: 2
state: absent
authorize: yes
become: yes
register: result
- assert:
@ -83,7 +78,6 @@
admin_distance: 2
state: absent
authorize: yes
become: yes
register: result
- assert:
@ -97,7 +91,6 @@
- { prefix: 172.16.33.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
state: present
authorize: yes
become: yes
register: result
- assert:
@ -113,7 +106,6 @@
- { prefix: 172.16.34.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
state: present
authorize: yes
become: yes
register: result
- assert:
@ -129,7 +121,6 @@
- { prefix: 172.16.34.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
state: absent
authorize: yes
become: yes
register: result
- assert:

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -8,7 +8,6 @@
- no ip domain-list redhat.com
match: none
authorize: yes
become: yes
- name: configure domain_search
ios_system:
@ -16,7 +15,6 @@
- ansible.com
- redhat.com
authorize: yes
become: yes
register: result
- assert:
@ -31,7 +29,6 @@
- ansible.com
- redhat.com
authorize: yes
become: yes
register: result
- assert:
@ -43,7 +40,6 @@
domain_search:
- ansible.com
authorize: yes
become: yes
register: result
- assert:
@ -56,7 +52,6 @@
domain_search:
- ansible.com
authorize: yes
become: yes
register: result
- assert:
@ -69,7 +64,6 @@
- ansible.com
- redhat.com
authorize: yes
become: yes
register: result
- assert:
@ -83,7 +77,6 @@
- ansible.com
- redhat.com
authorize: yes
become: yes
register: result
- assert:
@ -96,7 +89,6 @@
- ansible.com
- eng.ansible.com
authorize: yes
become: yes
register: result
- assert:
@ -112,7 +104,6 @@
- ansible.com
- eng.ansible.com
authorize: yes
become: yes
register: result
- assert:
@ -127,6 +118,5 @@
- no ip domain-list eng.ansible.com
match: none
authorize: yes
become: yes
- debug: msg="END cli/set_domain_search.yaml on connection={{ ansible_connection }}"

View file

@ -6,13 +6,11 @@
lines: no ip domain-name
match: none
authorize: yes
become: yes
- name: configure domain_name
ios_system:
domain_name: eng.ansible.com
authorize: yes
become: yes
register: result
- assert:
@ -23,7 +21,6 @@
ios_system:
domain_name: eng.ansible.com
authorize: yes
become: yes
register: result
- assert:
@ -35,6 +32,5 @@
lines: no ip domain-name
match: none
authorize: yes
become: yes
- debug: msg="END cli/set_domain_name.yaml on connection={{ ansible_connection }}"

View file

@ -6,13 +6,11 @@
lines: hostname switch
match: none
authorize: yes
become: yes
- name: configure hostname
ios_system:
hostname: foo
authorize: yes
become: yes
register: result
- assert:
@ -23,7 +21,6 @@
ios_system:
hostname: foo
authorize: yes
become: yes
register: result
- assert:
@ -35,6 +32,5 @@
lines: "hostname {{ inventory_hostname }}"
match: none
authorize: yes
become: yes
- debug: msg="END cli/set_hostname.yaml on connection={{ ansible_connection }}"

View file

@ -8,13 +8,11 @@
- vrf definition ansible
match: none
authorize: yes
become: yes
- name: configure lookup_source
ios_system:
lookup_source: Loopback888
authorize: yes
become: yes
register: result
- assert:
@ -26,7 +24,6 @@
ios_system:
lookup_source: Loopback888
authorize: yes
become: yes
register: result
- assert:
@ -37,7 +34,6 @@
ios_system:
lookup_enabled: False
authorize: yes
become: yes
register: result
- assert:
@ -49,7 +45,6 @@
ios_system:
lookup_enabled: True
authorize: yes
become: yes
register: result
- assert:
@ -64,7 +59,6 @@
# vrf: ansible
# authorize: yes
# provider: "{{ cli }}"
# become: yes
# register: result
#
#- assert:
@ -81,7 +75,6 @@
# vrf: ansible
# authorize: yes
# provider: "{{ cli }}"
# become: yes
# register: result
#
#- assert:
@ -95,7 +88,6 @@
- no vrf definition ansible
match: none
authorize: yes
become: yes
ignore_errors: yes
# FIXME: Not sure why this is failing with msg": "no vrf definition ansible\r\n% IPv4 and IPv6 addresses from all interfaces in VRF ansible have been removed\r\nfoo(config)#", rc:1

View file

@ -7,7 +7,6 @@
- no ip name-server
match: none
authorize: yes
become: yes
- name: configure name_servers
ios_system:
@ -16,7 +15,6 @@
- 2.2.2.2
- 3.3.3.3
authorize: yes
become: yes
register: result
- assert:
@ -34,7 +32,6 @@
- 2.2.2.2
- 3.3.3.3
authorize: yes
become: yes
register: result
- assert:
@ -76,7 +73,6 @@
- 1.1.1.1
- 2.2.2.2
authorize: yes
become: yes
register: result
- assert:
@ -91,6 +87,5 @@
- no ip name-server
match: none
authorize: yes
become: yes
- debug: msg="END cli/set_name_servers.yaml on connection={{ ansible_connection }}"

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -8,7 +8,6 @@
state: present
authorize: yes
configured_password: pass123
become: yes
- name: test login
expect:
@ -35,7 +34,6 @@
name: auth_user
state: absent
authorize: yes
become: yes
register: result
- name: reset connection

View file

@ -7,7 +7,6 @@
- name: ansibletest3
state: absent
authorize: yes
become: yes
- name: Create user (SetUp)
ios_user:
@ -16,7 +15,6 @@
role: network-operator
state: present
authorize: yes
become: yes
register: result
- assert:
@ -32,7 +30,6 @@
authorize: yes
state: present
view: network-admin
become: yes
register: result
- assert:
@ -47,7 +44,6 @@
role: network-operator
state: present
authorize: yes
become: yes
register: result
- assert:
@ -63,7 +59,6 @@
authorize: yes
state: present
view: network-admin
become: yes
register: result
- assert:
@ -79,7 +74,6 @@
- name: ansibletest3
state: absent
authorize: yes
become: yes
register: result
- assert:

View file

@ -10,13 +10,13 @@
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
include: "{{ test_case_to_run }} ansible_connection=network_cli ansible_become=yes"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -6,7 +6,6 @@
# - no vlan 200
# - no vlan 300
# authorize: yes
# become: yes
#- name: setup - remove switchport settings on interfaces used in test
# ios_config:
@ -15,7 +14,6 @@
# - no switchport access vlan 100
# authorize: yes
# parents: "{{ item }}"
# become: yes
# with_items:
# - interface GigabitEthernet0/1
# - interface GigabitEthernet0/2
@ -25,7 +23,6 @@
# vlan_id: 100
# name: test-vlan
# authorize: yes
# become: yes
# register: result
#- assert:
@ -36,7 +33,6 @@
#- name: create vlan(idempotence)
# ios_vlan: *create
# become: yes
# register: result
#- assert:
@ -50,7 +46,6 @@
# - GigabitEthernet0/1
# - GigabitEthernet0/2
# authorize: yes
# become: yes
# register: result
#- assert:
@ -65,7 +60,6 @@
#- name: Add interfaces to vlan(idempotence)
# ios_vlan: *interfaces
# become: yes
# register: result
#- assert:
@ -78,7 +72,6 @@
# interfaces:
# - GigabitEthernet0/1
# authorize: yes
# become: yes
# register: result
#- assert:
@ -91,7 +84,6 @@
#- name: Remove interface from vlan(idempotence)
# ios_vlan: *single_int
# become: yes
# register: result
#- assert:
@ -103,7 +95,6 @@
# vlan_id: 100
# state: suspend
# authorize: yes
# become: yes
# register: result
#- assert:
@ -117,7 +108,6 @@
# vlan_id: 100
# state: active
# authorize: yes
# become: yes
# register: result
#- assert:
@ -131,7 +121,6 @@
# vlan_id: 100
# authorize: yes
# state: absent
# become: yes
# register: result
#- assert:
@ -141,7 +130,6 @@
#- name: delete vlan(idempotence)
# ios_vlan: *delete
# become: yes
# register: result
#- assert:
@ -154,7 +142,6 @@
# - { vlan_id: 200, name: vlan-200 }
# - { vlan_id: 300, name: vlan-300 }
# authorize: yes
# become: yes
# register: result
#- assert:
@ -167,7 +154,6 @@
#- name: create vlans using aggregate(idempotence)
# ios_vlan: *create_aggregate
# become: yes
# register: result
#- assert:
@ -181,7 +167,6 @@
# - { vlan_id: 300, name: vlan-300 }
# state: absent
# authorize: yes
# become: yes
# register: result
#- assert:
@ -192,7 +177,6 @@
#- name: delete vlans using aggregate(idempotence)
# ios_vlan: *delete_aggregate
# become: yes
# register: result
#- assert:
@ -206,7 +190,6 @@
# - no vlan 200
# - no vlan 300
# authorize: yes
# become: yes
#- name: teardown(part2)
# ios_config:
@ -215,7 +198,6 @@
# - no switchport access vlan 100
# authorize: yes
# parents: "{{ item }}"
# become: yes
# with_items:
# - interface GigabitEthernet0/1
# - interface GigabitEthernet0/2