- name: fun fun fun
shell:
cmd: |
#!/bin/bash
SCRIPT=$(cat <<EOF
echo "hello world!"
EOF
)
${SCRIPT}
Solution found
here:
https://stackoverflow.com/questions/40230184/how-to-do-multiline-shell-script-in-ansible
On Monday, October 16, 2017 at 6:43:34 AM UTC+2, [email protected] wrote:
>
>
> I am trying to use a "here doc" in a shell command like so:
>
> - name: frustration
> shell: |
> cat <<-EOF | my_program
> input line 1
> input line 2
> EOF
> another_program
>
> along with a number of permutations, all of which have resulted in "bash:
> line 3: warning: here-document at line 0 delimited by end-of-file (wanted
> `EOF')".
>
> I found this:
> https://github.com/ansible/ansible/issues/12856
> which seems to imply there is some way to accomplish what I'm trying do
> but I can't understand how, nor do I see anything else relevant in the
> Ansible docs or Google.
>
> What is the magic syntax for the above?
>
>
>
--
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/044af4cf-90bc-438f-8999-2620455a0153%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.