1---
2- debug: msg="START cli/save.yaml on connection={{ ansible_connection }}"
3
4- name: setup
5  vyos.vyos.vyos_config:
6    lines: set system host-name {{ inventory_hostname_short }}
7    match: none
8
9- name: configure hostaname and save
10  register: result
11  vyos.vyos.vyos_config:
12    lines: set system host-name foo
13    save: true
14
15- assert:
16    that:
17      - result.changed == true
18      - "'set system host-name foo' in result.commands"
19
20- name: configure hostaname and don't save
21  register: result
22  vyos.vyos.vyos_config:
23    lines: set system host-name bar
24
25- assert:
26    that:
27      - result.changed == true
28      - "'set system host-name bar' in result.commands"
29
30- name: save config
31  register: result
32  vyos.vyos.vyos_config:
33    save: true
34
35- assert:
36    that:
37      - result.changed == true
38
39- name: save config again
40  register: result
41  vyos.vyos.vyos_config:
42    save: true
43
44- assert:
45    that:
46      - result.changed == false
47
48- name: teardown
49  vyos.vyos.vyos_config:
50    lines: set system host-name {{ inventory_hostname_short }}
51    match: none
52    save: true
53
54- debug: msg="END cli/simple.yaml on connection={{ ansible_connection }}"
55