Hi Kai.

Trust you are well, we are testing adding new configs via Ansible on the 
SBC, just struggling, to handle the various prompt changes, as you navigate 
the different configuration levels, and I have tweaked the playbook, but 
not coming right.

Here is the below output. 

The full traceback is:
File 
"/tmp/ansible_expect_payload_zp_yu2yh/ansible_expect_payload.zip/ansible/modules/commands/expect.py",
 
line 123, in wrapped
fatal: [###########]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"chdir": null,
"command": "ssh admin@##########",
"creates": null,
"echo": false,
"removes": null,
"responses": {
"(?i)password": "########",
"(configure)#": [
"media-manager realm-config"
],
"(realm-config)#": [
"identifier TEST_REALM_2",
"addr-prefix 10.1.0.0/29",
"network-interfaces PEER_F00:0",
"mm-in-realm disabled",
"mm-in-network enabled",
"mm-same-ip  disabled",
"mm-in-system enabled",
"access-control-trust-level medium",
"invalid-signal-threshold 1'",
"maximum-signal-threshold 4000",
"untrusted-signal-threshold  0",
"options sip-connect-pbx-reg",
"qos-enable enabled",
"accounting-enable enabled",
"done",
"quit"
],
"HA1#": [
"save-config",
"verify-confog",
"activate-config"
]
},
"timeout": 30
}
},
"msg": "No remaining responses for 'HA1#', output was ' 
activate-config\r\nActivate-Config received, processing.\r\nwaiting for 
request to finish\r\nRequest to 'ACTIVATE-CONFIG' has Finished, 
\r\nActivate Complete\r\nLABHA1#'"
}
...ignoring


Here is my playbook:

- name: Add config centrex child realm
  hosts: 10.11.171.20
  connection: local
  gather_facts: yes


  tasks:

  - name: Add config
    expect:
      command: ssh admin@##########
      responses:
       (?i)password: "##########"
       'HA1#':
       - conf t
       '(configure)#':
       - media-manager realm-config
       '(realm-config)#':
       - identifier TEST_REALM_2
       - addr-prefix 10.1.0.0/29
       - network-interfaces PEER_F00:0
       - mm-in-realm disabled
       - mm-in-network enabled
       - mm-same-ip  disabled
       - mm-in-system enabled
       - access-control-trust-level medium
       - invalid-signal-threshold 1'
       - maximum-signal-threshold 4000
       - untrusted-signal-threshold  0
       - options sip-connect-pbx-reg
       - qos-enable enabled
       - accounting-enable enabled
       - done
       - quit
       'HA1#':
       - save-config
       - verify-confog
       - activate-config
    ignore_errors: true
    register: labsbc

  - debug: var=labsbc.stdout_lines

On Wednesday, 5 February 2020 11:05:57 UTC+2, Gerhard Van Der Wath wrote:
>
> Hi.
>
> I am having an issue with Ansible's expect module.
>
> I am trying to run simple commands on a Oracle SBC, but getting some 
> errors.
>
> Playbook:
>
> - name: Check CPU
> hosts: all
> connection: local
> gather_facts: yes
>
>
> tasks:
>
> - name: Get CPU load
> expect:
> command: ssh admin@#########
> responses:
> 'password: ':
> - #######
> '#':
> - sh platform cpu-load
>
>
>
> Error:
>
> fatal: [######]: FAILED! => { "changed": false, "invocation": { 
> "module_args": { "chdir": null, "command": "ssh admin@######", "creates": 
> null, "echo": false, "removes": null, "responses": { "#": [ "sh platform 
> cpu-load" ], "password: ": [ "######" ] }, "timeout": 30 } }, "msg": "No 
> remaining responses for '#', output was ' sh platform 
> cpu-load\r\nTimestamp: 10:49:41 Wed 2020-02-05\r\nTotal load : 4%\r\nCPU 00 
> load : 5%\r\nCPU 01 load : 3%\r\nCPU 02 load : 5%\r\nCPU 03 load : 
> 5%\r\nVOXBDLHA1#'" } 
>
> I #ed out the IP and password
>
> Your assistance will be appreciated.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/84dc791c-65a2-4df2-9878-3ad805cc2b4eo%40googlegroups.com.

Reply via email to