ansible/test/integration/targets/junos_command/tests/cli/cli_commmand.yaml

65 lines
1.3 KiB
YAML
Raw Normal View History

---
- debug:
msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}"
- block:
- name: get output for single command
cli_command:
command: show version
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: test with prompt and answer
cli_command:
command: "{{ item }}"
prompt:
- "Exit with uncommitted changes"
answer: yes
loop:
- configure
- set system syslog file test any any
- rollback
- exit
register: result
- assert:
that:
- "result.changed == false"
- cli_command:
command: "{{item}}"
prompt:
- "New password"
- "Retype new password"
answer:
- "Test1234"
- "Test1234"
check_all: True
loop:
- "configure"
- "rollback"
- "set system login user ansible_test class operator authentication plain-text-password"
- "commit"
register: result
ignore_errors: True
- assert:
that:
- "'failed' not in result"
- junos_netconf:
register: result
ignore_errors: True
- assert:
that:
- "result.failed == false"
when: ansible_connection == 'network_cli'
- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"