--- - 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 - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'vsrx01' in config.xml" - 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 state: present active: False provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'' in config.xml" - name: Activate hostname configuration junos_system: hostname: vsrx01 state: present active: True provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'vsrx01' in config.xml" - name: Delete hostname configuration junos_system: hostname: vsrx01 state: absent provider: "{{ netconf }}" register: result - assert: that: - "result.changed == true" - "'vsrx01' in config.xml" - 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 - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'ansible.com' in config.xml" - 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 state: present active: False provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'' in config.xml" - name: Activate domain name junos_system: domain_name: ansible.com state: present active: True provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'ansible.com' in config.xml" - name: Delete domain name junos_system: domain_name: ansible.com state: absent provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'ansible.com' not in config.xml" - 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 - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'test.com' in config.xml" - "'sample.com' in config.xml" - name: Set domain search (idempotency) 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 state: present active: False provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'test.com' in config.xml" - "'sample.com' in config.xml" - name: Activate domain search junos_system: domain_search: - test.com - sample.com state: present active: True provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'test.com' in config.xml" - "'sample.com' in config.xml" - name: Delete domain search junos_system: domain_search: - test.com - sample.com state: absent provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'test.com' not in config.xml" - "'sample.com' not in config.xml" - 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 - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'8.8.8.8' in config.xml" - "'8.8.4.4' in config.xml" - 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 state: present active: False provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'' in config.xml" - name: Activate name servers junos_system: name_servers: - 8.8.8.8 - 8.8.4.4 state: present active: True provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'8.8.8.8' in config.xml" - "'8.8.4.4' in config.xml" - name: Delete name servers junos_system: name_servers: - 8.8.8.8 - 8.8.4.4 state: absent provider: "{{ netconf }}" register: result - name: Get running configuration junos_rpc: rpc: get-configuration provider: "{{ netconf }}" register: config - assert: that: - "result.changed == true" - "'8.8.8.8' not in config.xml" - "'8.8.4.4' not in config.xml"