Skip to content

Commit

Permalink
step_ca: fix installs for 0.25.2+ (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhoesel authored Nov 30, 2023
1 parent 705a15a commit 821b3a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
25 changes: 19 additions & 6 deletions roles/step_ca/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,45 @@

- name: Download and install step-ca
block:
- name: Create temporary download directory
ansible.builtin.tempfile:
state: directory
suffix: step_ca_install
register: _tempfile
- name: Download and extract step-ca archive
unarchive:
src: "https://github.com/smallstep/certificates/releases/download/v{{ step_ca_version }}/step-ca_linux_{{ step_ca_version }}_{{ step_ca_arch[ansible_architecture] }}.tar.gz"
dest: /tmp/
dest: "{{ _tempfile.path }}"
remote_src: yes
retries: 3
delay: 3
- name: Install step-ca binary <0.23 # noqa no-changed-when
shell: >
set -o pipefail &&
mv -Z /tmp/step-ca_{{ step_ca_version }}/bin/* {{ step_ca_executable | dirname }}
mv -Z {{ _tempfile.path }}/step-ca_{{ step_ca_version }}/bin/* {{ step_ca_executable | dirname }}
args:
executable: /bin/bash
notify: restart step-ca
when: step_ca_version is version("0.23", "<")
- name: Install step-ca binary >=0.23 # noqa no-changed-when
- name: Install step-ca binary >=0.23,<0.25.2 # noqa no-changed-when
shell: >
set -o pipefail &&
mv -Z /tmp/step-ca_{{ step_ca_version }}/step-ca {{ step_ca_executable | dirname }}
mv -Z {{ _tempfile.path }}/step-ca_{{ step_ca_version }}/step-ca {{ step_ca_executable | dirname }}
args:
executable: /bin/bash
notify: restart step-ca
when: step_ca_version is version("0.23", ">=")
when: step_ca_version is version("0.23", ">=") and step_ca_version is version("0.25.2", "<")
- name: Install step-ca binary >=0.25.2 # noqa no-changed-when
shell: >
set -o pipefail &&
mv -Z {{ _tempfile.path }}/step-ca {{ step_ca_executable | dirname }}
args:
executable: /bin/bash
notify: restart step-ca
when: step_ca_version is version("0.25.2", ">=")
always:
- name: Remove step release archive
file:
path: "/tmp/step-ca_{{ step_ca_version }}"
path: "{{ _tempfile.path }}/step-ca_{{ step_ca_version }}"
state: absent
when: (step_ca_installed_version.stdout) | default("") != step_ca_version
1 change: 0 additions & 1 deletion roles/step_cli/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

- name: Install step-cli
block:

- name: Download and extract step-cli archive
unarchive:
src: "https://github.com/smallstep/cli/releases/download/v{{ step_cli_version }}/step_linux_{{ step_cli_version }}_{{ step_cli_arch[ansible_architecture] }}.tar.gz"
Expand Down

0 comments on commit 821b3a1

Please sign in to comment.