Advanced example using shell with other executable (#21462)

The shell module is quite versatile in its use.
This commit is contained in:
Dag Wieers 2017-02-15 15:52:31 +01:00 committed by John R Barker
parent 34da024e06
commit 39a8638ec0

View file

@ -104,6 +104,26 @@ EXAMPLES = '''
- name: Run a command using a templated variable (always use quote filter to avoid injection)
shell: cat {{ myfile|quote }}
# 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 "\n{{ cimc_name }}"
send "connect host\n"
expect "pxeboot.n12"
send "\n"
exit 0
args:
executable: /usr/bin/expect
delegate_to: localhost
'''
RETURN = '''