2018-01-17 14:29:28 +00:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "START netconf/set_hostname.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: setup
|
|
|
|
iosxr_config:
|
|
|
|
lines: hostname switch
|
|
|
|
match: none
|
|
|
|
provider: "{{ cli }}"
|
2018-01-24 14:16:27 +00:00
|
|
|
connection: network_cli
|
2018-01-17 14:29:28 +00:00
|
|
|
|
|
|
|
- name: configure hostname
|
|
|
|
iosxr_system:
|
|
|
|
hostname: foo
|
|
|
|
provider: "{{ netconf }}"
|
2018-01-24 14:16:27 +00:00
|
|
|
connection: netconf
|
2018-01-17 14:29:28 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: verify hostname
|
|
|
|
iosxr_system:
|
|
|
|
hostname: foo
|
|
|
|
provider: "{{ netconf }}"
|
2018-01-24 14:16:27 +00:00
|
|
|
connection: netconf
|
2018-01-17 14:29:28 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- always:
|
|
|
|
- name: teardown
|
|
|
|
iosxr_config:
|
|
|
|
lines: "hostname {{ inventory_hostname }}"
|
|
|
|
match: none
|
|
|
|
provider: "{{ cli }}"
|
2018-01-24 14:16:27 +00:00
|
|
|
connection: network_cli
|
2018-01-17 14:29:28 +00:00
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "END netconf/set_hostname.yaml on connection={{ ansible_connection }}"
|