Hello - 

I solved a similar problem before by following a suggestion on the shell 
module <http://docs.ansible.com/ansible/shell_module.html> page.

To sanitize any variables passed to the shell module, you should use “{{ 
> var | quote }}” instead of just “{{ var }}” to make sure they don’t include 
> evil things like semicolons.


Based on the _raw_params in the verbose output, your variables do contain 
hyphens, colons, etc. Ansible might be interpreting these as something you 
don't want.

Maybe. Give it a shot. :)

On Wednesday, November 30, 2016 at 5:08:35 PM UTC-6, colin byrne wrote:
>
> I am trying to use the shell module to generate a diff between two remote 
> files, but it is erring out without giving me a warning or error: 
>
> - name: create diff of old settings file and new settings file
>   shell: diff /home/deploy/{{ application_name 
> }}/shared/config/settings.yml /home/deploy/{{ application_name 
> }}/shared/config/settings.yml.ansible_old_version >> /home/deploy/{{ 
> application_name }}/shared/config/settings.yml_diffs_1
>   when: settings_file.changed
>
>
> It executes totally fine when run directly in a shell on the remote 
> machine... 
>
> Here is the verbose error output, which doesn't seem to give much of use:
>
> Thanks for any help or workaround! I've spent too much time on this...
>
> fatal: [staging]: FAILED! => {"changed": true, "cmd": "diff 
> /home/deploy/app_name/shared/config/settings.yml 
> /home/deploy/app_name/shared/config/settings.yml.ansible_old_version 
> > 
> /home/deploy/coverhound/shared/config/settings.yml_diffs/settings.yml_2016-11-30_14:45:54",
>  
> "delta": "0:00:00.002778", "end": "2016-11-30 14:45:57.198400", "failed": 
> true, "invocation": {"module_args": {"_raw_params": "diff 
> /home/deploy/coverhound/shared/config/settings.yml 
> /home/deploy/app_name/shared/config/settings.yml.ansible_old_version > 
> /home/deploy/app_name/shared/config/settings.yml_diffs/settings.yml_2016-11-30_14:45:54",
>  
> "_uses_shell": true, "chdir": null, "creates": null, "executable": 
> "/bin/bash", "removes": null, "warn": true}, "module_name": "command"}, 
> "rc": 1, "start": "2016-11-30 14:45:57.195622", "stderr": "", "stdout": "", 
> "stdout_lines": [], "warnings": []}
>

-- 
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/da9e1f6c-a45c-49a1-83af-8e88898ec140%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to