summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/incidental_vyos_config/tests/cli/check_config.yaml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
commit8a754e0858d922e955e71b253c139e071ecec432 (patch)
tree527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/incidental_vyos_config/tests/cli/check_config.yaml
parentInitial commit. (diff)
downloadansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz
ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/incidental_vyos_config/tests/cli/check_config.yaml')
-rw-r--r--test/integration/targets/incidental_vyos_config/tests/cli/check_config.yaml63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/integration/targets/incidental_vyos_config/tests/cli/check_config.yaml b/test/integration/targets/incidental_vyos_config/tests/cli/check_config.yaml
new file mode 100644
index 0000000..f1ddc71
--- /dev/null
+++ b/test/integration/targets/incidental_vyos_config/tests/cli/check_config.yaml
@@ -0,0 +1,63 @@
+---
+- debug: msg="START cli/config_check.yaml on connection={{ ansible_connection }}"
+
+- name: setup- ensure interface is not present
+ vyos.vyos.vyos_config:
+ lines: delete interfaces loopback lo
+
+- name: setup- create interface
+ vyos.vyos.vyos_config:
+ lines:
+ - interfaces
+ - interfaces loopback lo
+ - interfaces loopback lo description test
+ register: result
+
+# note collapsing the duplicate lines doesn't work if
+# lines:
+# - interfaces loopback lo description test
+# - interfaces loopback lo
+# - interfaces
+
+- name: Check that multiple duplicate lines collapse into a single commands
+ assert:
+ that:
+ - "{{ result.commands|length }} == 1"
+
+- name: Check that set is correctly prepended
+ assert:
+ that:
+ - "result.commands[0] == 'set interfaces loopback lo description test'"
+
+- name: configure config_check config command
+ vyos.vyos.vyos_config:
+ lines: delete interfaces loopback lo
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: check config_check config command idempontent
+ vyos.vyos.vyos_config:
+ lines: delete interfaces loopback lo
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: check multiple line config filter is working
+ vyos.vyos.vyos_config:
+ lines:
+ - set system login user esa level admin
+ - set system login user esa authentication encrypted-password '!abc!'
+ - set system login user vyos level admin
+ - set system login user vyos authentication encrypted-password 'abc'
+ register: result
+
+- assert:
+ that:
+ - "{{ result.filtered|length }} == 2"
+
+- debug: msg="END cli/config_check.yaml on connection={{ ansible_connection }}"