mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
4.0 KiB
YAML
172 lines
4.0 KiB
YAML
7 years ago
|
---
|
||
|
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
|
||
|
|
||
|
- set_fact: switch_type="{{ switch_type }}"
|
||
|
|
||
|
- block:
|
||
|
|
||
|
- name: setup - remove config used in test(part1)
|
||
|
ios_config:
|
||
|
lines:
|
||
|
- no interface port-channel 20
|
||
|
authorize: yes
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: setup - remove config used in test(part2)
|
||
|
ios_config:
|
||
|
lines:
|
||
|
- no interface port-channel 5
|
||
|
authorize: yes
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: setup - remove config used in test(part3)
|
||
|
ios_config:
|
||
|
lines:
|
||
|
- no channel-group 20 mode active
|
||
|
authorize: yes
|
||
|
parents: "{{ item }}"
|
||
|
loop:
|
||
|
- interface GigabitEthernet0/1
|
||
|
- interface GigabitEthernet0/2
|
||
|
|
||
|
- name: create linkagg
|
||
|
ios_linkagg: &create
|
||
|
group: 20
|
||
|
state: present
|
||
|
authorize: yes
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "'interface port-channel 20' in result.commands"
|
||
|
|
||
|
- name: create linkagg(Idempotence)
|
||
|
ios_linkagg: *create
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- name: set link aggregation group to members
|
||
|
ios_linkagg: &configure_member
|
||
|
group: 20
|
||
|
mode: active
|
||
|
members:
|
||
|
- GigabitEthernet0/1
|
||
|
- GigabitEthernet0/2
|
||
|
authorize: yes
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "'interface GigabitEthernet0/1' in result.commands"
|
||
|
- "'channel-group 20 mode active' in result.commands"
|
||
|
- "'interface GigabitEthernet0/2' in result.commands"
|
||
|
- "'channel-group 20 mode active' in result.commands"
|
||
|
|
||
|
- name: set link aggregation group to members(Idempotence)
|
||
|
ios_linkagg: *configure_member
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- name: remove link aggregation group from member
|
||
|
ios_linkagg: &remove_member
|
||
|
group: 20
|
||
|
mode: active
|
||
|
members:
|
||
|
- GigabitEthernet0/2
|
||
|
authorize: yes
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "'interface GigabitEthernet0/1' in result.commands"
|
||
|
- "'no channel-group 20 mode active' in result.commands"
|
||
|
|
||
|
- name: remove link aggregation group from member(Idempotence)
|
||
|
ios_linkagg: *remove_member
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- name: remove linkagg
|
||
|
ios_linkagg: &remove
|
||
|
group: 20
|
||
|
state: absent
|
||
|
authorize: yes
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "'no interface port-channel 20' in result.commands"
|
||
|
|
||
|
- name: remove linkagg(Idempotence)
|
||
|
ios_linkagg: *remove
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- name: create aggregate of linkagg definitions
|
||
|
ios_linkagg: &create_agg
|
||
|
aggregate:
|
||
|
- { group: 5 }
|
||
|
- { group: 20, mode: active, members: ['GigabitEthernet0/1'] }
|
||
|
authorize: yes
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "'interface port-channel 5' in result.commands"
|
||
|
- "'interface port-channel 20' in result.commands"
|
||
|
- "'interface GigabitEthernet0/1' in result.commands"
|
||
|
- "'channel-group 20 mode active' in result.commands"
|
||
|
|
||
|
- name: create aggregate of linkagg definitions(Idempotence)
|
||
|
ios_linkagg: *create_agg
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- name: teardown(part1)
|
||
|
ios_config:
|
||
|
lines:
|
||
|
- no interface port-channel 20
|
||
|
authorize: yes
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: teardown(part2)
|
||
|
ios_config:
|
||
|
lines:
|
||
|
- no interface port-channel 5
|
||
|
authorize: yes
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: teardown(part3)
|
||
|
ios_config:
|
||
|
lines:
|
||
|
- no channel-group 20 mode active
|
||
|
authorize: yes
|
||
|
parents: "{{ item }}"
|
||
|
loop:
|
||
|
- interface GigabitEthernet0/1
|
||
|
- interface GigabitEthernet0/2
|
||
|
|
||
|
when: switch_type == 'L2'
|
||
|
|
||
|
- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}"
|