Skip to content

Commit

Permalink
Advanced example using shell with other executable (ansible#21462)
Browse files Browse the repository at this point in the history
The shell module is quite versatile in its use.
  • Loading branch information
dagwieers authored and gundalow committed Feb 15, 2017
1 parent 34da024 commit 39a8638
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/ansible/modules/commands/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,26 @@
- 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 = '''
Expand Down

0 comments on commit 39a8638

Please sign in to comment.