Skip to content

Rule to enforce idempotency of tasks #3058

Closed Answered by ssbarnea
nre-ableton asked this question in New rules
Discussion options

You must be logged in to vote

To be honest this can be achieved with:

- name: Set hostname
  become: true
  ansible.builtin.command: "hostnamectl set-hostname {{ system_hostname }}"
  when: hostname.stdout != system_hostname
  changed_when: hostname.stdout != system_hostname

I am not sure if we can make a rule for it. What would be needed, to require both when and changed_when to be present? If so, we still have the problem of conditions from upper block levels, which currently are not accessible to matchtask().

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nre-ableton
Comment options

Answer selected by nre-ableton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants