We are a little further, the second expect is not working

- 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.domain.com"
  
    exit 0
  args:
    executable: /usr/bin/expect

changed: [vm-host04.hq.domain.com] => {
    "changed": true, 
    "cmd": "set timeout 30\n spawn service swiagentd init\n\n expect \"Choose 
an option>\"\n send \"2\\n\"\n expect \"Enter Orion Poller Hostname/IP\"\n send 
\"orion.hq.domain.com\"\n\n exit 0", 
    "delta": "0:00:00.124392", 
    "end": "2019-01-15 10:46:13.836854", 
    "invocation": {
        "module_args": {
            "_raw_params": "set timeout 30\n spawn service swiagentd init\n\n 
expect \"Choose an option>\"\n send \"2\\n\"\n expect \"Enter Orion Poller 
Hostname/IP\"\n send \"orion.hq.domain.com\"\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:46:13.712462", 
    "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>2\r\nEnter Orion Poller Hostname/IP", 
    "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>2", 
        "Enter Orion Poller Hostname/IP"


> On Jan 15, 2019, at 9:10 AM, Freddie Eisa <freddiee...@gmail.com> 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 ansible-project+unsubscr...@googlegroups.com 
> <mailto:ansible-project+unsubscr...@googlegroups.com>.
> To post to this group, send email to ansible-project@googlegroups.com 
> <mailto:ansible-project@googlegroups.com>.
> 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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4D55CE9C-AC21-4486-8FD7-D57D7EF45B88%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to