I am trying to convert big old monolith bash script to ansible, and
I'm about 90% of the way there.
I am having a bit of trouble with one element, the docker entrypoint.
The original code along with my Ansible attempt and the entrypoint
debug output is here: https://pastebin.com/J1j49aKT
I *think* I have done everything correctly, but I do not get a
populated license file
I'm sure there is something glaringly obvious, but I can't seem to
put my finger on it.
you are relying on the bash shell to quote arguments for you correctly.
Ansible won't do such magic for you.
The `entrypoint` option expects a list of strings; if it is not a list
but a single string, it is treated as a comma-separated concatenated
list, i.e. split by commas. In your case, you end up with a single
string containing the whole command line. This is passed to docker as
the executable to run in your container, which will obviously fail.
You have to compose a proper `entrypoint` list.
Also, the redirect is not part of the thing docker should execut, but
something you have to handle on ansible level (i.e. ask the
docker_container module to capture stdout for you).
This is wrong. You need to remove the "> /srv/...", and pass the
`detach: false` option to docker_container to enable non-detaching and
stdout capturing. Then you need to register the output of the task, and
extract the output from there as `result.container.Output`.
Also, your command line specifies `--rm`, which is equivalent to
`auto_remove: true`.
And when I let command and detach false, same error :
“msg”: “Wrong number of arguments.\nUSAGE: /opt/guacamole/bin/initdb.sh [–postgres | --mysql]\nWrong number of arguments.\nUSAGE: /opt/guacamole/bin/initdb.sh [–postgres | --mysql]\nWrong number of arguments.\nUSAGE: /opt/guacamole/bin/initdb.sh [–postgres | --mysql]\nWrong number of arguments.\nUSAGE: /opt/guacamole/bin/initdb.sh [–postgres | --mysql]\nWrong number of arguments.\nUSAGE: /opt/guacamole/bin/initdb.sh [–postgres | --mysql]\nWrong number of arguments.\nUSAGE: /opt/guacamole/bin/initdb.sh [–postgres | --mysql]\n”,
“status”: 1
I have to set command to get work.
May I used volume, but how? Because with dry run docker run, it extract in the folder in argument.