Skip to content

Commit

Permalink
Modify approve CSRs task changed_when, failed_when
Browse files Browse the repository at this point in the history
The changed_when conditional has been modified to use the length Jinja
filter as this is what's used elsewhere in the codebase when having a
boolean expression for an empty string.

The failed_when conditional has been removed because I want this task to
fail when the command exits with a non-zero exit code. Conveniently,
this is already how failed_when is defined by default for the
ansible.builtin.command task module. I derived this through trial and
error, plus ansible's source code.
  • Loading branch information
cavcrosby committed Aug 14, 2024
1 parent b54e1a7 commit 9a64f89
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions playbooks/k8s_post_controllers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@

- name: Approves CSRs that are pending from nodes' kubelets
ansible.builtin.command: "{{ sign_kubelet_csrs_script_path }}"
changed_when: approve_csrs_script.stdout != ""
failed_when: approve_csrs_script.stderr != ""
changed_when: approve_csrs_script.stdout | length != 0
become: true
register: approve_csrs_script

Expand Down

0 comments on commit 9a64f89

Please sign in to comment.