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:
- Even if the error is ignored, it is still reported in the log display even if I have not enabled verbose mode
- 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”?