I'm using ansible 2.0, and I'm trying to create a script play which will correctly flag when a change was made, but so far I've been unable to get this to work. Here's what I have for the play:
- script: script {{ arg }} register: command_result failed_when: command_result.rc != 0 and command_result.rc != 1 changed_when: command_result.rc == 1 The script runs correctly, and reports success if no change happens. But, if it exits with code 1 to indicate that a change was made ansible is reporting that it failed: fatal: [vagrant]: FAILED! => {"stdout": "", "changed": true, "failed": false, "stderr": "", "rc": 1, "failed_when_result": false} I've also tried using: - script: script {{ arg }} register: command_result changed_when: "'updated' in command_result.stderr" With the script using stderr rather than the exit status to report the change, but in that case ansible never reports that a change was made. Is ideas about what I'm doing wrong? Thanks. -- 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-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c0b47c34-7c24-4efe-b238-c3b1e07006bc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.