2017-06-22 06:04:50 +02:00
|
|
|
---
|
|
|
|
- debug: msg="START junos_system netconf/basic.yaml"
|
|
|
|
|
|
|
|
- name: setup - remove hostname
|
|
|
|
junos_system:
|
|
|
|
hostname: vsrx01
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Set hostname
|
|
|
|
junos_system:
|
|
|
|
hostname: vsrx01
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<host-name>vsrx01</host-name>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Set hostname (idempotent)
|
|
|
|
junos_system:
|
|
|
|
hostname: vsrx01
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Deactivate hostname configuration
|
|
|
|
junos_system:
|
|
|
|
hostname: vsrx01
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: False
|
2017-06-22 06:04:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<host-name inactive=\"inactive\">' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Activate hostname configuration
|
|
|
|
junos_system:
|
|
|
|
hostname: vsrx01
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: True
|
2017-06-22 06:04:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<host-name>vsrx01</host-name>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Delete hostname configuration
|
|
|
|
junos_system:
|
|
|
|
hostname: vsrx01
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<host-name>vsrx01</host-name>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Teardown - set hostname
|
|
|
|
junos_system:
|
|
|
|
hostname: vsrx01
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: setup - remove domain name
|
|
|
|
junos_system:
|
|
|
|
domain_name: ansible.com
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Set domain name
|
|
|
|
junos_system:
|
|
|
|
domain_name: ansible.com
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<domain-name>ansible.com</domain-name>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Set domain name (idempotent)
|
|
|
|
junos_system:
|
|
|
|
domain_name: ansible.com
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Deactivate domain name
|
|
|
|
junos_system:
|
|
|
|
domain_name: ansible.com
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: False
|
2017-06-22 06:04:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<domain-name inactive=\"inactive\">' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Activate domain name
|
|
|
|
junos_system:
|
|
|
|
domain_name: ansible.com
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: True
|
2017-06-22 06:04:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<domain-name>ansible.com</domain-name>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Delete domain name
|
|
|
|
junos_system:
|
|
|
|
domain_name: ansible.com
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<domain-name>ansible.com</domain-name>' not in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Teardown - set domain name
|
|
|
|
junos_system:
|
|
|
|
domain_name: ansible.com
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Setup - delete domain search
|
|
|
|
junos_system:
|
|
|
|
domain_search:
|
|
|
|
- test.com
|
|
|
|
- sample.com
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Set domain search
|
|
|
|
junos_system:
|
|
|
|
domain_search:
|
|
|
|
- test.com
|
|
|
|
- sample.com
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<domain-search>test.com</domain-search>' in config.xml"
|
|
|
|
- "'<domain-search>sample.com</domain-search>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Set domain search (idempotency)
|
2017-06-22 06:04:50 +02:00
|
|
|
junos_system:
|
|
|
|
domain_search:
|
|
|
|
- test.com
|
|
|
|
- sample.com
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Deactivate domain search
|
|
|
|
junos_system:
|
|
|
|
domain_search:
|
|
|
|
- test.com
|
|
|
|
- sample.com
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: False
|
2017-06-22 06:04:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<domain-search inactive=\"inactive\">test.com</domain-search>' in config.xml"
|
|
|
|
- "'<domain-search inactive=\"inactive\">sample.com</domain-search>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Activate domain search
|
|
|
|
junos_system:
|
|
|
|
domain_search:
|
|
|
|
- test.com
|
|
|
|
- sample.com
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: True
|
2017-06-22 06:04:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<domain-search>test.com</domain-search>' in config.xml"
|
|
|
|
- "'<domain-search>sample.com</domain-search>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Delete domain search
|
|
|
|
junos_system:
|
|
|
|
domain_search:
|
|
|
|
- test.com
|
|
|
|
- sample.com
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<domain-search>test.com</domain-search>' not in config.xml"
|
|
|
|
- "'<domain-search>sample.com</domain-search>' not in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Setup - delete name servers
|
|
|
|
junos_system:
|
|
|
|
name_servers:
|
|
|
|
- 8.8.8.8
|
|
|
|
- 8.8.4.4
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Set name servers
|
|
|
|
junos_system:
|
|
|
|
name_servers:
|
|
|
|
- 8.8.8.8
|
|
|
|
- 8.8.4.4
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<name>8.8.8.8</name>' in config.xml"
|
|
|
|
- "'<name>8.8.4.4</name>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Set name servers (idempotent)
|
|
|
|
junos_system:
|
|
|
|
name_servers:
|
|
|
|
- 8.8.8.8
|
|
|
|
- 8.8.4.4
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Deactivate name servers
|
|
|
|
junos_system:
|
|
|
|
name_servers:
|
|
|
|
- 8.8.8.8
|
|
|
|
- 8.8.4.4
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: False
|
2017-06-22 06:04:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<name-server inactive=\"inactive\">' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Activate name servers
|
|
|
|
junos_system:
|
|
|
|
name_servers:
|
|
|
|
- 8.8.8.8
|
|
|
|
- 8.8.4.4
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: True
|
2017-06-22 06:04:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<name>8.8.8.8</name>' in config.xml"
|
|
|
|
- "'<name>8.8.4.4</name>' in config.xml"
|
2017-06-22 06:04:50 +02:00
|
|
|
|
|
|
|
- name: Delete name servers
|
|
|
|
junos_system:
|
|
|
|
name_servers:
|
|
|
|
- 8.8.8.8
|
|
|
|
- 8.8.4.4
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-22 06:04:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<name>8.8.8.8</name>' not in config.xml"
|
|
|
|
- "'<name>8.8.4.4</name>' not in config.xml"
|