Skip to content

Commit

Permalink
roles: fix step_cli_install var being overwritten (#379)
Browse files Browse the repository at this point in the history
roles: fix step_cli_install being overwritten

this patch renames the internal variables used by the roles to determine
whether step-cli is installed to a different value than the user-facing
`step_cli_install` variable that toggles installation.

Fixes a case where a user that set step_cli_install as a role variable
in their playbook would get errors about step_cli_install being a bool
and not having an RC object due to the internal var being overwritten.
  • Loading branch information
maxhoesel authored Apr 7, 2024
1 parent c403795 commit 4c93e7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions roles/step_acme_cert/tasks/check.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
- name: Look for step_cli_executable # noqa command-instead-of-shell
#"command" is a shell builtin, hence the need for the shell module
shell: "command -v {{ step_cli_executable }}"
register: step_cli_install
register: _step_cli_install
# dash (Debian sh shell) uses 127 instead of 1 for not found errors
failed_when: step_cli_install.rc not in [0,1,127]
failed_when: _step_cli_install.rc not in [0,1,127]
changed_when: no
check_mode: no
- name: Verify that `step-cli` is installed
assert:
that: step_cli_install.rc == 0
that: _step_cli_install.rc == 0
fail_msg: "Could not find step-cli at path '{{ step_cli_executable }}'. Please install step-cli via maxhoesel.smallstep.step_cli or step_bootstrap_host"
6 changes: 3 additions & 3 deletions roles/step_cli/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- name: Look for step_cli_executable # noqa command-instead-of-shell
#"command" is a shell builtin, hence the need for the shell module
shell: "command -v {{ step_cli_executable }}"
register: step_cli_install
register: _step_cli_install
# dash (Debian sh shell) uses 127 instead of 1 for not found errors
failed_when: step_cli_install.rc not in [0,1,127]
failed_when: _step_cli_install.rc not in [0,1,127]
changed_when: no
check_mode: no

Expand All @@ -16,7 +16,7 @@
changed_when: no
check_mode: no
register: step_cli_installed_version
when: step_cli_install.rc == 0
when: _step_cli_install.rc == 0

- name: Install step-cli
block:
Expand Down

0 comments on commit 4c93e7c

Please sign in to comment.