2016-10-28 20:50:29 +02:00
|
|
|
---
|
2018-01-08 13:28:47 +01:00
|
|
|
- debug: msg="START netconf/multiple.yaml on connection={{ ansible_connection }}"
|
2016-10-28 20:50:29 +02:00
|
|
|
|
|
|
|
- name: setup
|
|
|
|
junos_config:
|
|
|
|
lines:
|
2017-01-09 18:21:04 +01:00
|
|
|
- "set system host-name {{ inventory_hostname_short }}"
|
2016-10-28 20:50:29 +02:00
|
|
|
- "delete interfaces lo0"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: test
|
|
|
|
|
|
|
|
- name: configure multiple commands
|
|
|
|
junos_config:
|
|
|
|
lines:
|
2017-01-09 18:21:04 +01:00
|
|
|
- 'set system host-name {{ inventory_hostname_short }}'
|
2018-05-30 19:03:20 +02:00
|
|
|
- 'set interfaces lo0 unit 0 family inet address 192.0.2.1/32'
|
2016-10-28 20:50:29 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
# Ensure host-name *hasn't* been updated
|
|
|
|
- "'host-name;' not in result.diff.prepared"
|
|
|
|
# Ensure interface has *been* updated
|
2018-05-30 19:03:20 +02:00
|
|
|
- "'address 192.0.2.1/32' in result.diff.prepared"
|
2016-10-28 20:50:29 +02:00
|
|
|
|
|
|
|
- name: check multiple commands idempotent
|
|
|
|
junos_config:
|
|
|
|
lines:
|
2017-01-09 18:21:04 +01:00
|
|
|
- 'set system host-name {{ inventory_hostname_short }}'
|
2018-05-30 19:03:20 +02:00
|
|
|
- 'set interfaces lo0 unit 0 family inet address 192.0.2.1/32'
|
2016-10-28 20:50:29 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.diff is not defined"
|
|
|
|
|
|
|
|
- name: teardown
|
|
|
|
junos_config:
|
|
|
|
lines:
|
2017-01-09 18:21:04 +01:00
|
|
|
- "set system host-name {{ inventory_hostname_short }}"
|
2016-10-28 20:50:29 +02:00
|
|
|
- "delete interfaces lo0"
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: test
|
|
|
|
|
2018-01-08 13:28:47 +01:00
|
|
|
- debug: msg="END netconf/multiple.yaml on connection={{ ansible_connection }}"
|