Hi Stephen,
On Wed, 23 Oct 2019 00:24:26 -0700 (PDT)
Stephen Feyrer <
sf.gre...@gmail.com> wrote:
> Apologies for the delayed reply. Unfortunately, that hasn't worked. In
> the documentation that you linked to, that syntax is described in
> connection with the shell operator rather than the script.
>
> I tried this:
> - name: my-script
> script: My-Script.ps1 -secret {{ vault_password | quote }}
> and
> - name: my-script
> script: My-Script.ps1 -secret {{ vault_password | join("") }}
> Both produced the same result as before.
This is strange. It works for me.
$ cat my-script.sh
#!/bin/sh
echo $1
exit 0
$ cat play.yml
- hosts: localhost
vars:
vault_password: abc(123
tasks:
- script: 'my-script.sh {{ vault_password|quote }}'
register: result
- debug:
var: result.stdout
$ ansible-playbook play.yml
[...]
ok: [localhost] => {
"result.stdout": "abc(123\n"
}
Without quoted argument I see this error:
fatal: [localhost]: FAILED! => {"changed": true, "msg": "non-zero return
code", "rc": 2, "stderr": "/bin/sh: 1: Syntax error: \"(\" unexpected\n",
"stderr_lines": ["/bin/sh: 1: Syntax error: \"(\" unexpected"], "stdout":
"", "stdout_lines": []}
Cheers,
-vlado