2017-12-26 09:24:27 +01:00
|
|
|
---
|
2019-05-24 03:22:27 +02:00
|
|
|
- debug:
|
|
|
|
msg: "START eos_l3_interface eapi/basic.yaml on connection={{ ansible_connection }}"
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Set test interface
|
|
|
|
set_fact:
|
|
|
|
test_interface_1: ethernet1
|
|
|
|
test_interface_2: ethernet2
|
2019-05-24 03:22:27 +02:00
|
|
|
ipv4_addr_1: 192.0.2.5/24
|
|
|
|
ipv4_addr_2: 198.51.100.15/24
|
|
|
|
ipv4_addr_3: 203.0.113.25/28
|
|
|
|
ipv4_addr_4: 203.0.113.225/28
|
|
|
|
ipv6_addr_1: 2001:DB8:123::/64
|
|
|
|
ipv6_addr_2: 2001:DB8:ABC::/64
|
|
|
|
ipv6_addr_3: 2001:DB8::/48
|
|
|
|
ipv6_addr_4: 2001:DB8:FFFF::/90
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Delete interface ipv4 and ipv6 address(setup)
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: &clear
|
2017-12-26 09:24:27 +01:00
|
|
|
name: "{{ test_interface_1 }}"
|
|
|
|
state: absent
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Configure interface ipv4 address
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: &ipv4
|
2017-12-26 09:24:27 +01:00
|
|
|
name: "{{ test_interface_1 }}"
|
2019-05-24 03:22:27 +02:00
|
|
|
ipv4: "{{ ipv4_addr_1 }}"
|
2017-12-26 09:24:27 +01:00
|
|
|
state: present
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
2019-05-24 03:22:27 +02:00
|
|
|
- '"ip address {{ ipv4_addr_1 }}" in result.commands'
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Configure interface ipv4 address (idempotent)
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: *ipv4
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
2019-05-24 03:22:27 +02:00
|
|
|
- assert: &unchanged
|
2017-12-26 09:24:27 +01:00
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Change interface ipv4 address
|
|
|
|
eos_l3_interface:
|
|
|
|
name: "{{ test_interface_1 }}"
|
2019-05-24 03:22:27 +02:00
|
|
|
ipv4: "{{ ipv4_addr_2 }}"
|
2017-12-26 09:24:27 +01:00
|
|
|
state: present
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
2019-05-24 03:22:27 +02:00
|
|
|
- '"ip address {{ ipv4_addr_2 }}" in result.commands'
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Configure interface ipv6 address
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: &ipv6
|
2017-12-26 09:24:27 +01:00
|
|
|
name: "{{ test_interface_1 }}"
|
2019-05-24 03:22:27 +02:00
|
|
|
ipv6: "{{ ipv6_addr_1 }}"
|
2017-12-26 09:24:27 +01:00
|
|
|
state: present
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
2019-05-24 03:22:27 +02:00
|
|
|
- '"ipv6 address {{ ipv6_addr_1 }}" in result.commands'
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Configure interface ipv6 address (idempotent)
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: *ipv6
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
2019-05-24 03:22:27 +02:00
|
|
|
- assert: *unchanged
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Change interface ipv6 address
|
|
|
|
eos_l3_interface:
|
|
|
|
name: "{{ test_interface_1 }}"
|
2019-05-24 03:22:27 +02:00
|
|
|
ipv6: "{{ ipv6_addr_2 }}"
|
2017-12-26 09:24:27 +01:00
|
|
|
state: present
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
2019-05-24 03:22:27 +02:00
|
|
|
- '"ipv6 address {{ ipv6_addr_2 }}" in result.commands'
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Delete interface ipv4 and ipv6 address
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: *clear
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
|
|
|
- '"no ip address" in result.commands'
|
|
|
|
- '"no ipv6 address" in result.commands'
|
|
|
|
|
|
|
|
- name: Delete interface ipv4 and ipv6 address (idempotent)
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: *clear
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
2019-05-24 03:22:27 +02:00
|
|
|
- assert: *unchanged
|
|
|
|
|
2017-12-26 09:24:27 +01:00
|
|
|
- name: Delete second interface ipv4 and ipv6 address (setup)
|
|
|
|
eos_l3_interface:
|
|
|
|
name: "{{ test_interface_2 }}"
|
|
|
|
state: absent
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Configure ipv4 and ipv6 address using aggregate
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: &aggregate
|
2017-12-26 09:24:27 +01:00
|
|
|
aggregate:
|
2019-05-24 03:22:27 +02:00
|
|
|
- { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_3 }}", ipv6: "{{ ipv6_addr_3 }}" }
|
|
|
|
- { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_1 }}", ipv6: "{{ ipv6_addr_1 }}" }
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
2019-05-24 03:22:27 +02:00
|
|
|
- '"ip address {{ ipv4_addr_3 }}" in result.commands'
|
|
|
|
- '"ipv6 address {{ ipv6_addr_3 }}" in result.commands'
|
2017-12-26 09:24:27 +01:00
|
|
|
- '"interface {{ test_interface_2 }}" in result.commands'
|
2019-05-24 03:22:27 +02:00
|
|
|
- '"ip address {{ ipv4_addr_1 }}" in result.commands'
|
|
|
|
- '"ipv6 address {{ ipv6_addr_1 }}" in result.commands'
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Configure ipv4 and ipv6 address using aggregate (idempotent)
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: *aggregate
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
2019-05-24 03:22:27 +02:00
|
|
|
- assert: *unchanged
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
- name: Change ipv4 and ipv6 address using aggregate
|
|
|
|
eos_l3_interface:
|
|
|
|
aggregate:
|
2019-05-24 03:22:27 +02:00
|
|
|
- { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_2 }}", ipv6: "{{ ipv6_addr_2 }}" }
|
|
|
|
- { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_4 }}", ipv6: "{{ ipv6_addr_4 }}" }
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
2019-05-24 03:22:27 +02:00
|
|
|
- '"ip address {{ ipv4_addr_2 }}" in result.commands'
|
|
|
|
- '"ipv6 address {{ ipv6_addr_2 }}" in result.commands'
|
2017-12-26 09:24:27 +01:00
|
|
|
- '"interface {{ test_interface_2 }}" in result.commands'
|
2019-05-24 03:22:27 +02:00
|
|
|
- '"ip address {{ ipv4_addr_4 }}" in result.commands'
|
|
|
|
- '"ipv6 address {{ ipv6_addr_4 }}" in result.commands'
|
2017-12-26 09:24:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
- name: Delete ipv4 and ipv6 address using aggregate
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: &clear_both
|
2017-12-26 09:24:27 +01:00
|
|
|
aggregate:
|
|
|
|
- { name: "{{ test_interface_1 }}" }
|
|
|
|
- { name: "{{ test_interface_2 }}" }
|
|
|
|
state: absent
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
|
|
|
- '"no ip address" in result.commands'
|
|
|
|
- '"no ipv6 address" in result.commands'
|
|
|
|
- '"interface {{ test_interface_2 }}" in result.commands'
|
|
|
|
- '"no ip address" in result.commands'
|
|
|
|
- '"no ipv6 address" in result.commands'
|
|
|
|
|
|
|
|
- name: Delete ipv4 and ipv6 address using aggregate (idempotent)
|
2019-05-24 03:22:27 +02:00
|
|
|
eos_l3_interface: *clear_both
|
2018-05-29 20:18:03 +02:00
|
|
|
become: yes
|
2017-12-26 09:24:27 +01:00
|
|
|
register: result
|
|
|
|
|
2019-05-24 03:22:27 +02:00
|
|
|
- assert: *unchanged
|
2017-12-26 09:24:27 +01:00
|
|
|
|
2019-05-24 03:22:27 +02:00
|
|
|
- debug:
|
|
|
|
msg: "END eos_l3_interface eapi/basic.yaml on connection={{ ansible_connection }}"
|