Instead of ignore_errors: True, consider: failed_when: False
The reporting of changed always can be fixed with changed_when: False On Wed, Jul 23, 2014 at 1:14 PM, Synaesthete <[email protected]> wrote: > I'm writing a playbook that runs an initial git commit on a folder if > there has not yet been a commit. I check this using: > > - name: Get commit count > command: git rev-list HEAD --count chdir={{ project_path }} > ignore_errors: yes > register: git_commit_count > > If there have been no commits, this command returns an error, in which > case I then conditionally run a few other git-related steps. I have two > issues with this: > > 1. Even if the error is ignored, it is still reported in the log > display even if I have not enabled verbose mode > 2. This step always reports "changed" which breaks my idempotency > check that ensures changed=0 on a second run > > Is there a good way to work around this? Can I take this step "off the > record"? > > -- > 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/e7a16351-f652-4d12-96a9-5be523b32aad%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/e7a16351-f652-4d12-96a9-5be523b32aad%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CA%2BnsWgw-FDgeVua61GT5AF5%2BEk7CWWAs0fgfY7PmFf6qPjib2g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
