summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml
blob: 2269e7479322531c1f5590c1c7f649783cfa1fd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
- debug:
    msg: START vyos_ntp_global overridden integration tests on connection={{
      ansible_connection }}

- include_tasks: _remove_config.yaml

- include_tasks: _populate_config.yaml

- block:

    - name: Override the existing configuration with the provided running configuration
      register: result
      vyos.vyos.vyos_ntp_global: &id001
        config:
          servers:
            - server: server1
              options:
                - dynamic
                - prefer

            - server: server2
              options:
                - noselect
                - preempt

            - server: server_add
              options:
                - preempt
        state: overridden

    - vyos.vyos.vyos_facts:
        gather_network_resources: ntp_global

    - assert:
        that:
          - result.changed == true
          - result.after == ansible_facts['network_resources']['ntp_global']
          - result.after == overridden.after

    - name: Override the existing configuration with the provided running configuration
        (IDEMPOTENT)
      register: result
      vyos.vyos.vyos_ntp_global: *id001

    - name: Assert that the previous task was idempotent
      assert:
        that:
          - result['changed'] == false

  always:

    - include_tasks: _remove_config.yaml