If it’s worthwhile to write a shell script in Ansible, you most likely have one thing like this:
- identify: iterate person teams
shell: groupmod -o -g {{ merchandise['guid'] }} {{ merchandise['username'] }}
with_items: "{{ customers }}"
However how do you write multiline shell scripts with this format?
How you can write Multiline shell scripts
- identify: iterate person teams
shell: |
groupmod -o -g {{ merchandise['guid'] }} {{ merchandise['username'] }}
do_some_stuff_here
and_some_other_stuff
with_items: "{{ customers }}"
Simply be aware that Ansible can do some unusual issues with manipulations of arguments, so you could need to observe one thing like this:
- shell: |
cat <<EOF
This can be a check.
EOF
Or higher but, wrap them:
- shell:
cmd: |
cat <<EOF
This can be a check.
EOF