On Sat, 1 Apr 2017, Uditha Desilva wrote:

Even in RHEL 7, the version of pexpect isn't good enough. The easiest option is 
to use pip to install it from PyPi.

My solution to expect is documented in the shell-module documentation:

    http://docs.ansible.com/ansible/shell_module.html

Which boils down to:

    # You can use shell to run other executables to perform actions inline
    - name: Run expect to wait for a successful PXE boot via out-of-band CIMC
      shell: |
        set timeout 300
        spawn ssh admin@{{ cimc_host }}

        expect "password:"
        send "{{ cimc_password }}\n"

        expect "# "
        send "connect host\n"

        expect "pxeboot.n12"
        send "\n"
      args:
        executable: /usr/bin/expect
      connection: local

Which is a lot more versatile than the expect module IMO.
--
Dag

--
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/alpine.LRH.2.20.1705091501260.19483%40pikachu.3ti.be.
For more options, visit https://groups.google.com/d/optout.

Reply via email to