- 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
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": []}
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.