summaryrefslogtreecommitdiff
path: root/test/integration/targets/vyos_command/tests/cli/cli_command.yaml
blob: 08a7675b7d67a3d7cec8eb71f295e284622bf747 (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
---
- debug:
    msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}"

- block:
  - name: get output for single command
    network.cli.cli_command:
      command: show version
    register: result

  - assert:
      that:
        - "result.changed == false"
        - "result.stdout is defined"

  - name: send invalid command
    network.cli.cli_command:
      command: 'show foo'
    register: result
    ignore_errors: yes

  - assert:
      that:
        - "result.failed == true"
        - "result.msg is defined"
  when: "ansible_connection == 'network_cli'"

- block:
  - name: test failure for local connection
    network.cli.cli_command:
      command: show version
    register: result
    ignore_errors: yes

  - assert:
      that:
        - 'result.failed == true'
        - "'Connection type local is not valid for this module' in result.msg"
  when: "ansible_connection == 'local'"

- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"