diff --git a/tasks/install_remote.yml b/tasks/install_remote.yml index 7c603ef8..ea34bbe5 100644 --- a/tasks/install_remote.yml +++ b/tasks/install_remote.yml @@ -15,20 +15,22 @@ - name: Download and unarchive Consul block: - - name: Read Consul package checksum file - ansible.builtin.stat: - path: "{{ consul_temp_dir.path }}/consul_{{ consul_version }}_SHA256SUMS" - register: consul_checksum - changed_when: false - tags: installation - - name: Download Consul package checksum file # noqa risky-file-permissions - ansible.builtin.get_url: + - name: Get Consul checksum + ansible.builtin.uri: url: "{{ consul_checksum_file_url }}" - dest: "{{ consul_temp_dir.path }}/consul_{{ consul_version }}_SHA256SUMS" - validate_certs: false - tags: installation - when: not consul_checksum.stat.exists | bool + return_content: yes + use_proxy: "{{ use_proxy }}" + register: checksum_file + failed_when: checksum_file.status != 200 + tags: + - installation + + - name: Find checksum line + set_fact: + consul_sha256: "{{ (checksum_file.content.splitlines() | select('search', consul_pkg) | first).split()[0] }}" + tags: + - installation - name: Read Consul package checksum ansible.builtin.shell: grep {{ consul_pkg }} {{ consul_temp_dir.path }}/consul_{{ consul_version }}_SHA256SUMS @@ -36,14 +38,14 @@ changed_when: false tags: - installation - - skip_ansible_lint - - name: Download Consul # noqa risky-file-permissions + - name: Download Consul ansible.builtin.get_url: url: "{{ consul_zip_url }}" dest: "{{ consul_temp_dir.path }}/{{ consul_pkg }}" - checksum: sha256:{{ consul_sha256.stdout.split(' ') | first }} + checksum: sha256:{{ consul_sha256 }} timeout: 42 + use_proxy: "{{ use_proxy }}" register: consul_download tags: installation