---
- debug: msg="START net_system junos/basic.yaml"
- name: setup - remove hostname
net_system:
hostname: vsrx01
state: absent
provider: "{{ netconf }}"
- name: Set hostname
net_system:
hostname: vsrx01
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'vsrx01' in result.rpc"
- name: Set hostname (idempotent)
net_system:
hostname: vsrx01
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate hostname configuration
net_system:
hostname: vsrx01
state: suspend
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'' in result.rpc"
- name: Activate hostname configuration
net_system:
hostname: vsrx01
state: active
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'' in result.rpc"
- name: Delete hostname configuration
net_system:
hostname: vsrx01
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'' in result.rpc"
- name: Teardown - set hostname
net_system:
hostname: vsrx01
state: present
provider: "{{ netconf }}"
- name: setup - remove domain name
net_system:
domain_name: ansible.com
state: absent
provider: "{{ netconf }}"
- name: Set domain name
net_system:
domain_name: ansible.com
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'ansible.com' in result.rpc"
- name: Set domain name (idempotent)
net_system:
domain_name: ansible.com
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate domain name
net_system:
domain_name: ansible.com
state: suspend
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'' in result.rpc"
- name: Activate domain name
net_system:
domain_name: ansible.com
state: active
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'' in result.rpc"
- name: Delete domain name
net_system:
domain_name: ansible.com
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'' in result.rpc"
- name: Teardown - set domain name
net_system:
domain_name: ansible.com
state: present
provider: "{{ netconf }}"
- name: Setup - delete domain search
net_system:
domain_search:
- test.com
- sample.com
state: absent
provider: "{{ netconf }}"
register: result
- name: Set domain search
net_system:
domain_search:
- test.com
- sample.com
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'test.com' in result.rpc"
- "'sample.com' in result.rpc"
- name: Set domain search
net_system:
domain_search:
- test.com
- sample.com
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate domain search
net_system:
domain_search:
- test.com
- sample.com
state: suspend
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'test.com' in result.rpc"
- "'sample.com' in result.rpc"
- name: Activate domain search
net_system:
domain_search:
- test.com
- sample.com
state: active
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'test.com' in result.rpc"
- "'sample.com' in result.rpc"
- name: Delete domain search
net_system:
domain_search:
- test.com
- sample.com
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'test.com' in result.rpc"
- "'sample.com' in result.rpc"
- name: Setup - delete name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: absent
provider: "{{ netconf }}"
register: result
- name: Set name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'8.8.8.8' in result.rpc"
- "'8.8.4.4' in result.rpc"
- name: Set name servers (idempotent)
net_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
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: suspend
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'8.8.8.8' in result.rpc"
- "'8.8.4.4' in result.rpc"
- name: Activate name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: active
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'8.8.8.8' in result.rpc"
- "'8.8.4.4' in result.rpc"
- name: Delete name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'8.8.8.8' in result.rpc"
- "'8.8.4.4' in result.rpc"