Skip to content

Commit a342eef

Browse files
metanoviiSergei Mikhaltsov
andauthored
made it a little prettier (#603)
* made it a little prettier --------- Co-authored-by: Sergei Mikhaltsov <[email protected]>
1 parent 0dd4761 commit a342eef

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

tasks/install_remote.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,30 @@
1515

1616
- name: Download and unarchive Consul
1717
block:
18-
- name: Read Consul package checksum file
19-
ansible.builtin.stat:
20-
path: "{{ consul_temp_dir.path }}/consul_{{ consul_version }}_SHA256SUMS"
21-
register: consul_checksum
22-
changed_when: false
23-
tags: installation
2418

25-
- name: Download Consul package checksum file # noqa risky-file-permissions
26-
ansible.builtin.get_url:
19+
- name: Get Consul checksum
20+
ansible.builtin.uri:
2721
url: "{{ consul_checksum_file_url }}"
28-
dest: "{{ consul_temp_dir.path }}/consul_{{ consul_version }}_SHA256SUMS"
29-
validate_certs: false
30-
tags: installation
31-
when: not consul_checksum.stat.exists | bool
22+
return_content: true
23+
use_proxy: "{{ use_proxy }}"
24+
register: checksum_file
25+
failed_when: checksum_file.status != 200
26+
tags:
27+
- installation
3228

33-
- name: Read Consul package checksum
34-
ansible.builtin.shell: grep {{ consul_pkg }} {{ consul_temp_dir.path }}/consul_{{ consul_version }}_SHA256SUMS
35-
register: consul_sha256
36-
changed_when: false
29+
- name: Find checksum line
30+
ansible.builtin.set_fact:
31+
consul_sha256: "{{ (checksum_file.content.splitlines() | select('search', consul_pkg) | first).split()[0] }}"
3732
tags:
3833
- installation
39-
- skip_ansible_lint
4034

4135
- name: Download Consul # noqa risky-file-permissions
4236
ansible.builtin.get_url:
4337
url: "{{ consul_zip_url }}"
4438
dest: "{{ consul_temp_dir.path }}/{{ consul_pkg }}"
45-
checksum: sha256:{{ consul_sha256.stdout.split(' ') | first }}
39+
checksum: sha256:{{ consul_sha256 }}
4640
timeout: 42
41+
use_proxy: "{{ use_proxy }}"
4742
register: consul_download
4843
tags: installation
4944

0 commit comments

Comments
 (0)