Hello, I am using the shell module to run a command inside a docker container and it is giving me a yaml error. The command is stupid silly complicated ;-) Is there a way to get Ansible to just send it as is and ignore \ escape out the characters that may be freaking out Yaml?Here is an example of a basic command that does work.shell: docker exec -it 9d5e563a6e9e bash -c "cd /var/log ; ls; cat bootstrap.log"However this command gives me a yaml erorshell: docker exec -it 9d5e563a6e9e bash -c "echo 'rs.initiate({_id: \"mongors1conf\",configsvr: true, members: [{ _id : 0, host : \"mongocfg1\" },{ _id : 1, host : \"mongocfg2\" }, { _id : 2, host : \"mongocfg3\" }]})' | mongo"Here is a snippet of the errorERROR! Syntax Error while loading YAML.mapping values are not allowed in this contextshell: docker exec -it 9d5e563a6e9e bash -c "echo 'rs.initiate({_id: \"mongors1conf\",configsvr: true, members: [{ _id : 0, host : \"mongocfg1\" },{ _id : 1, host : \"mongocfg2\" }, { _id : 2, host : \"mongocfg3\" }]})' | mongo"^ hereThis command works just fine at the bash shell of the docker host. I have tried the ansible shell and the Ansible command module
I know this command looks complicated but please keep in mind I am only asking how to format this to work in Ansible. I am not asking you to understand docker exec Mongodb commands ;-)Thanks for your help
--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a8cf8352-2e86-4ca8-9179-2a1600b26a89n%40googlegroups.com.
Joe Langdon
Sometimes when you think life is kicking you in the ass, it's actually just moving you quickly to a better place.