Hi there,
I have a playbook with the following set of tasks:
-
name: Check if the GPG key is present
sudo: yes
sudo_user: foobar
command: gpg --list-keys XXXXX
ignore_errors: true
register: gpg_result -
name: Import the signing GPG key
sudo: yes
sudo_user: foobar
command: gpg --import /home/foobar/pubkey.gpg
when: gpg_result|failed
The idea being, check if a GPG key is present, and, if not, import it. I’d like to add some sort of flag that states that the first task (which always runs) doesn’t actually modify anything, and thus shouldn’t be counted as having “changed”. Is there a way to do this? Note that this isn’t the only example - the general pattern of “run command, depending on result, run other(s)” has come up before.
Thanks,
–Andrew D