Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 15394

Scripting • Re: Ansible 'expect' module like prompt response

$
0
0
Hello,
i am struggling with sth similar. After resetting CHR to defaults any new cli shell prompts "Do you want to see the software license?". I need to answer N with Ansible. But its not working.

Code:
- name: testExpect  expect:    command: "sshpass -p {{ ansible_ssh_pass }} ssh -o StrictHostKeyChecking=no {{ ansible_user }}@{{ ansible_host }}"    responses:      '(.*)Do you want to see the software license\? \[Y\/n\]\:': 'n'    echo: true    timeout: 10  delegate_to: localhost  ignore_errors: true

the result is:
Code:
TASK [testExpect] *********************************************************************************************************************************fatal: [t-Router_v7]: FAILED! => changed=true  cmd: sshpass -p **** ssh -o StrictHostKeyChecking=no ansible@IP  delta: '0:00:10.110704'  end: '2024-03-24 12:00:08.925207'  msg: non-zero return code  rc: 255  start: '2024-03-24 11:59:58.814503'  stdout: |-    [9999B[9999BZ  [6n  stdout_lines: <omitted>  

Statistics: Posted by eifLZ9D8zSwW — Sun Mar 24, 2024 1:14 pm



Viewing all articles
Browse latest Browse all 15394

Trending Articles