ee3f8d28a4
* Fix cli context check for network_cli connection Fixes #64575 * Check cli context for network_cli connection at the start of new task run only. * Pass task_uuid around to identify start of new task run * Handle for local connection
64 lines
1.3 KiB
YAML
64 lines
1.3 KiB
YAML
---
|
|
- 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 }}"
|