Skip to content

Commit d56a271

Browse files
Merge pull request #357 from WhizUs/feature/356-timeout-get-url-configurable
feat: make get_url timeouts configurable
2 parents 8e1c4ec + c2323d5 commit d56a271

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ rke2_artifact:
165165
- rke2.linux-{{ rke2_architecture }}.tar.gz
166166
- rke2-images.linux-{{ rke2_architecture }}.tar.zst
167167

168+
# Timeout for fetching artifacts in seconds
169+
rke2_artifact_fetch_timeout: 30
170+
168171
# Changes the deploy strategy to install based on local artifacts
169172
rke2_airgap_mode: false
170173

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ rke2_artifact:
126126
- rke2.linux-{{ rke2_architecture }}.tar.gz
127127
- rke2-images.linux-{{ rke2_architecture }}.tar.zst
128128

129+
# Timeout for fetching artifacts in seconds
130+
rke2_artifact_fetch_timeout: 30
131+
129132
# Changes the deploy strategy to install based on local artifacts
130133
rke2_airgap_mode: false
131134

meta/argument_specs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ argument_specs:
201201
elements: str
202202
description: "Airgap required artifacts"
203203

204+
rke2_artifact_fetch_timeout:
205+
type: int
206+
default: 30
207+
description: "Timeout for fetching artifacts in seconds"
208+
204209
rke2_airgap_mode:
205210
type: bool
206211
default: false

tasks/rke2.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
url: "{{ rke2_install_bash_url }}"
55
dest: "{{ rke2_install_script_dir }}/rke2.sh"
66
mode: 0700
7+
timeout: "{{ rke2_artifact_fetch_timeout }}"
78
when: not rke2_airgap_mode
89

910
- name: Copy local RKE2 installation script
@@ -36,21 +37,21 @@
3637
dest: "{{ rke2_artifact_path }}/sha256sum-{{ rke2_architecture }}.txt"
3738
force: yes
3839
mode: 0640
39-
timeout: 30
40+
timeout: "{{ rke2_artifact_fetch_timeout }}"
4041
- name: Download RKE2 artifacts and compare with checksums ( airgap mode )
4142
ansible.builtin.get_url:
4243
url: "{{ rke2_artifact_url }}/{{ rke2_version }}/{{ item }}"
4344
dest: "{{ rke2_artifact_path }}/{{ item }}"
4445
mode: 0640
4546
checksum: "sha256:{{ rke2_artifact_url }}/{{ rke2_version }}/sha256sum-{{ rke2_architecture }}.txt"
46-
timeout: 30
47+
timeout: "{{ rke2_artifact_fetch_timeout }}"
4748
with_items: "{{ rke2_artifact | reject('search', 'sha256sum') | list }}"
4849
- name: Download RKE2 install script ( airgap mode )
4950
ansible.builtin.get_url:
5051
url: "{{ rke2_install_bash_url }}"
5152
dest: "{{ rke2_install_script_dir }}/rke2.sh"
5253
mode: 0700
53-
timeout: 30
54+
timeout: "{{ rke2_artifact_fetch_timeout }}"
5455
rescue:
5556
- name: "Remote downloading failed: Downloading locally and pushing to remote hosts ( airgap mode - download locally and push to remote )"
5657
ansible.builtin.pause: # Slight delay to make sure you know it's gonna happen and have time to cancel
@@ -73,7 +74,7 @@
7374
force: yes
7475
mode: 0640
7576
owner: "{{ lookup('env', 'USER') }}"
76-
timeout: 30
77+
timeout: "{{ rke2_artifact_fetch_timeout }}"
7778
- name: Downloading RKE2 artifacts locally
7879
delegate_to: localhost
7980
run_once: true
@@ -83,6 +84,7 @@
8384
dest: "{{ rke2_airgap_copy_sourcepath }}/"
8485
mode: 0640
8586
owner: "{{ lookup('env', 'USER') }}"
87+
timeout: "{{ rke2_artifact_fetch_timeout }}"
8688
with_items: "{{ [rke2_artifact_url + '/' + rke2_version + '/'] | product(rke2_artifact) | map('join') | list + [rke2_install_bash_url] }}"
8789
- name: Download RKE2 install script locally
8890
delegate_to: localhost
@@ -92,6 +94,7 @@
9294
dest: "{{ rke2_airgap_copy_sourcepath }}/rke2.sh"
9395
mode: 0700
9496
owner: "{{ lookup('env', 'USER') }}"
97+
timeout: "{{ rke2_artifact_fetch_timeout }}"
9598
- name: Copy local RKE2 files to remote hosts
9699
ansible.builtin.copy:
97100
src: "{{ rke2_airgap_copy_sourcepath }}/"

0 commit comments

Comments
 (0)