Use Ansible expect module without question

32 views
Skip to first unread message

Charles Giudicelli

unread,
Aug 22, 2017, 8:49:43 AM8/22/17
to Ansible Project
Hi,

I 'd like to use the expect plugin to send commands to a configuration soft that doesn't ask questions, but only waits for instructions.

Here is how work my prog

1. I run the programm in CLI: "loracmd -ns 127.0.0.1"
2. I have no questions and no prompt sign
3. I enter the commands:
ns
set allowRemoteConfiguration 1
quit

And that's it.

I have found some exemples, someting like this on the net.

- name: Run expect to configure lora servers
  become: yes
  expect:
    command: "loracmd -ns 127.0.0.1"
    responses:
      ".*" :
        - "ns"
        - "set allowRemoteConfiguration 1"
        - "quit"
  register: result
  until: result.failed is not defined
  tags:
    - configuration-lora-net

But apparently somehting is not working as I have this error:
"msg": "No remaining responses for '.*', output was ''"

I am wondering as the module seems to looks for a string for question and use reg exp to find the question and answers it, maybe it's not working for me ?

Any advices ?

Brest regards,
Charles.


Reply all
Reply to author
Forward
0 new messages