One more update. Looks like most of this is working now besides the final part. 
My assumption is I need to wildcard or use a different escape character. Please 
provide any feedback 

- name: Configure Orion Agent 
  shell: |
    set timeout 30
    spawn service swiagentd init

    expect "Choose an option>"
    send "2\n" 
    expect "Enter Orion Poller Hostname/IP"
    send "orion.hq.crabel.com\n"
    expect "Choose an option>"
    send "4\n"  
    expect "Enter Orion Username"
    send "orion_agent\n" 
    expect "Choose an option>"
    send "5\n"
    expect "Enter Orion Password"
    send "{{ orion_agent_password }}\n"
    expect "Choose an option>"
    send "7\n"    
    expect "..."
    send "\n"
  args:
    executable: /usr/bin/expect


        "", 
        "Choose an option>7", 
        "", 
        "Agent device ID [F988BC59-EEC5-42E3-81BE-6E854E5A1000], Provisioned by 
[ch1-mntrw001], device ID [A7C87BAE-07A0-4D74-A3CE-D0810B04B347]", 
        "Press ENTER to continue…"




> On Jan 15, 2019, at 9:10 AM, Freddie Eisa <[email protected]> wrote:
> 
> We are trying the following 
> 
> 
> - name: Configure Orion Agent
>   shell: |
>     set timeout 30
>     spawn service swiagentd init
> 
>     expect "Choose an option>"
>     send "2"
> 
>     exit 0
>   args:
>     executable: /usr/bin/expect
> 
> 
> We are able to spawn the process but it looks like the expect part never 
> works 
> 
>     "changed": true, 
>     "cmd": "set timeout 30\n spawn service swiagentd init\n\n expect \"Choose 
> an option>\"\n send \"2\"\n\n exit 0", 
>     "delta": "0:00:00.132261", 
>     "end": "2019-01-15 10:08:43.611145", 
>     "invocation": {
>         "module_args": {
>             "_raw_params": "set timeout 30\n spawn service swiagentd init\n\n 
> expect \"Choose an option>\"\n send \"2\"\n\n exit 0", 
>             "_uses_shell": true, 
>             "argv": null, 
>             "chdir": null, 
>             "creates": null, 
>             "executable": "/usr/bin/expect", 
>             "removes": null, 
>             "stdin": null, 
>             "warn": true
>         }
>     }, 
>     "rc": 0, 
>     "start": "2019-01-15 10:08:43.478884", 
>     "stderr": "", 
>     "stderr_lines": [], 
>     "stdout": "spawn service swiagentd init\r\n\r\nSolarWinds Orion Agent 
> [2.0.0.70] Settings, OpenSSL [OpenSSL 1.0.2k-fips  26 Jan 2017]\r\n   0. 
> Cancel and Exit without Saving\r\n   1. Agent Mode (1 - Agent Initiated, 0 - 
> Server Initiated)  [1]\r\n   2. Orion Poller Hostname/IP  [localhost]\r\n   
> 3. Orion Poller Port         [17778]\r\n   4. Orion Username            
> [admin]\r\n   5. Orion Password            []\r\n   6. Proxy Settings...      
>    [mode=disabled]\r\n   7. Save Changes and Exit\r\n\r\nChoose an option>", 
>     "stdout_lines": [
>         "spawn service swiagentd init", 
>         "", 
>         "SolarWinds Orion Agent [2.0.0.70] Settings, OpenSSL [OpenSSL 
> 1.0.2k-fips  26 Jan 2017]", 
>         "   0. Cancel and Exit without Saving", 
>         "   1. Agent Mode (1 - Agent Initiated, 0 - Server Initiated)  [1]", 
>         "   2. Orion Poller Hostname/IP  [localhost]", 
>         "   3. Orion Poller Port         [17778]", 
>         "   4. Orion Username            [admin]", 
>         "   5. Orion Password            []", 
>         "   6. Proxy Settings...         [mode=disabled]", 
>         "   7. Save Changes and Exit", 
>         "", 
>         "Choose an option>"
>     ]
> }
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/7f439e10-1883-46c4-8f0b-d069dfb8938e%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/7f439e10-1883-46c4-8f0b-d069dfb8938e%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9F4DA14B-0A28-468B-9259-28C9B901839D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to