|
|
@ -1,32 +1,49 @@
|
|
|
|
---
|
|
|
|
---
|
|
|
|
- debug: msg="START junos_lldp netconf/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
- debug: msg="START junos_lldp netconf/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: setup - Disable lldp and remove it's configuration
|
|
|
|
- name: get supported protocols
|
|
|
|
|
|
|
|
junos_command:
|
|
|
|
|
|
|
|
commands: show lldp
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: lldp supported
|
|
|
|
|
|
|
|
set_fact:
|
|
|
|
|
|
|
|
lldp_supported: True
|
|
|
|
|
|
|
|
when: not result.failed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: lldp not supported
|
|
|
|
|
|
|
|
set_fact:
|
|
|
|
|
|
|
|
lldp_supported: False
|
|
|
|
|
|
|
|
when: result.failed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: setup - Disable lldp and remove it's configuration
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Enable lldp
|
|
|
|
- name: Enable lldp
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Enable lldp (idempotent)
|
|
|
|
- name: Enable lldp (idempotent)
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
|
|
|
|
- name: configure lldp parameters and enable lldp
|
|
|
|
- name: configure lldp parameters and enable lldp
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
interval: 10
|
|
|
|
interval: 10
|
|
|
|
hold_multiplier: 5
|
|
|
|
hold_multiplier: 5
|
|
|
@ -35,14 +52,14 @@
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "result.changed == true"
|
|
|
|
- result.diff.prepared is search("\+ *advertisement-interval 10")
|
|
|
|
- result.diff.prepared is search("\+ *advertisement-interval 10")
|
|
|
|
- result.diff.prepared is search("\+ *transmit-delay 2")
|
|
|
|
- result.diff.prepared is search("\+ *transmit-delay 2")
|
|
|
|
- result.diff.prepared is search("\+ *hold-multiplier 5")
|
|
|
|
- result.diff.prepared is search("\+ *hold-multiplier 5")
|
|
|
|
|
|
|
|
|
|
|
|
- name: configure lldp parameters and enable lldp(idempotent)
|
|
|
|
- name: configure lldp parameters and enable lldp(idempotent)
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
interval: 10
|
|
|
|
interval: 10
|
|
|
|
hold_multiplier: 5
|
|
|
|
hold_multiplier: 5
|
|
|
@ -51,11 +68,11 @@
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
|
|
|
|
- name: configure lldp parameters and disable lldp
|
|
|
|
- name: configure lldp parameters and disable lldp
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
interval: 10
|
|
|
|
interval: 10
|
|
|
|
hold_multiplier: 5
|
|
|
|
hold_multiplier: 5
|
|
|
@ -64,7 +81,7 @@
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "result.changed == true"
|
|
|
|
- result.diff.prepared is search("\+ *disable")
|
|
|
|
- result.diff.prepared is search("\+ *disable")
|
|
|
@ -72,7 +89,7 @@
|
|
|
|
- "'transmit-delay 2;' not in result.diff.prepared"
|
|
|
|
- "'transmit-delay 2;' not in result.diff.prepared"
|
|
|
|
- "'hold-multiplier 5;' not in result.diff.prepared"
|
|
|
|
- "'hold-multiplier 5;' not in result.diff.prepared"
|
|
|
|
|
|
|
|
|
|
|
|
- name: configure lldp parameters and enable lldp
|
|
|
|
- name: configure lldp parameters and enable lldp
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
interval: 10
|
|
|
|
interval: 10
|
|
|
|
hold_multiplier: 5
|
|
|
|
hold_multiplier: 5
|
|
|
@ -81,7 +98,7 @@
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "result.changed == true"
|
|
|
|
- result.diff.prepared is search("\- *disable")
|
|
|
|
- result.diff.prepared is search("\- *disable")
|
|
|
@ -89,7 +106,7 @@
|
|
|
|
- "'transmit-delay 2;' not in result.diff.prepared"
|
|
|
|
- "'transmit-delay 2;' not in result.diff.prepared"
|
|
|
|
- "'hold-multiplier 5;' not in result.diff.prepared"
|
|
|
|
- "'hold-multiplier 5;' not in result.diff.prepared"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Remove lldp configuration and diable lldp
|
|
|
|
- name: Remove lldp configuration and diable lldp
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
interval: 10
|
|
|
|
interval: 10
|
|
|
|
hold_multiplier: 5
|
|
|
|
hold_multiplier: 5
|
|
|
@ -98,7 +115,7 @@
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "result.changed == true"
|
|
|
|
- result.diff.prepared is search("\+ *disable")
|
|
|
|
- result.diff.prepared is search("\+ *disable")
|
|
|
@ -106,14 +123,16 @@
|
|
|
|
- result.diff.prepared is search("\- *transmit-delay 2")
|
|
|
|
- result.diff.prepared is search("\- *transmit-delay 2")
|
|
|
|
- result.diff.prepared is search("\- *hold-multiplier 5")
|
|
|
|
- result.diff.prepared is search("\- *hold-multiplier 5")
|
|
|
|
|
|
|
|
|
|
|
|
- name: Remove lldp (idempotent)
|
|
|
|
- name: Remove lldp (idempotent)
|
|
|
|
junos_lldp:
|
|
|
|
junos_lldp:
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
when: lldp_supported
|
|
|
|
|
|
|
|
|
|
|
|
- debug: msg="END junos_lldp netconf/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
- debug: msg="END junos_lldp netconf/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|