2018-08-06 16:41:57 +02:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
2018-08-13 07:32:43 +02:00
|
|
|
- block:
|
|
|
|
- name: get output for single command
|
|
|
|
cli_command:
|
|
|
|
command: show version
|
|
|
|
register: result
|
2018-08-06 16:41:57 +02:00
|
|
|
|
2018-08-13 07:32:43 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.stdout is defined"
|
2018-08-06 16:41:57 +02:00
|
|
|
|
2018-08-13 07:32:43 +02:00
|
|
|
- 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
|
2018-08-23 11:18:44 +02:00
|
|
|
- rollback
|
2018-08-13 07:32:43 +02:00
|
|
|
- exit
|
|
|
|
register: result
|
2018-08-06 16:41:57 +02:00
|
|
|
|
2018-08-13 07:32:43 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
2019-11-26 04:10:49 +01:00
|
|
|
|
|
|
|
- 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"
|
|
|
|
|
2018-08-13 07:32:43 +02:00
|
|
|
when: ansible_connection == 'network_cli'
|
2018-08-06 16:41:57 +02:00
|
|
|
|
|
|
|
- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"
|