summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml
blob: 2a22ad8f231c9eb3697465d8375ec1b2f0ee4eb5 (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
54
55
56
57
58
---
- debug:
    msg: START vyos_ntp_global merged integration tests on connection={{
      ansible_connection }}

- include_tasks: _remove_config.yaml

- block:
    - name: Merge the provided configuration with the existing running configuration
      register: result
      vyos.vyos.vyos_ntp_global: &id001
        config:
          servers:
            - server: server5

            - server: server4
              options:
                - noselect
                - dynamic

            - server: 10.3.6.5
              options:
                - noselect
                - preempt
                - dynamic
                - prefer
        state: merged

    - vyos.vyos.vyos_facts:
        gather_network_resources: ntp_global

    - assert:
        that:
          - result.commands|length == 7
          - result.changed == true
          - result.commands|symmetric_difference(merged.commands) == []
          - result.after == ansible_facts['network_resources']['ntp_global']
          - result.after == merged.after


    - name: Assert that before dicts were correctly generated
      assert:
        that:
          - result.before == populate.config

    - name:
        Merge the provided configuration with the existing 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