Skip to content

Commit c24257d

Browse files
author
Michal Muransky
committed
fix: airgap mode
1 parent 597c980 commit c24257d

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

tasks/rke2.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,39 @@
3030
- rke2_airgap_mode
3131
- rke2_airgap_implementation == 'download'
3232
block:
33-
- name: Download sha256 checksum file
33+
- name: Download sha256 checksum file ( airgap mode )
3434
ansible.builtin.get_url:
3535
url: "{{ rke2_artifact_url }}/{{ rke2_version }}/sha256sum-{{ rke2_architecture }}.txt"
3636
dest: "{{ rke2_artifact_path }}/sha256sum-{{ rke2_architecture }}.txt"
3737
force: yes
3838
mode: 0640
3939
timeout: 30
40-
- name: Download RKE2 artifacts and compare with checksums
40+
- name: Download RKE2 artifacts and compare with checksums ( airgap mode )
4141
ansible.builtin.get_url:
4242
url: "{{ rke2_artifact_url }}/{{ rke2_version }}/{{ item }}"
4343
dest: "{{ rke2_artifact_path }}/{{ item }}"
4444
mode: 0640
4545
checksum: "sha256:{{ rke2_artifact_url }}/{{ rke2_version }}/sha256sum-{{ rke2_architecture }}.txt"
4646
timeout: 30
4747
with_items: "{{ rke2_artifact | reject('search', 'sha256sum') | list }}"
48+
- name: Download RKE2 install script ( airgap mode )
49+
ansible.builtin.get_url:
50+
url: "{{ rke2_install_bash_url }}"
51+
dest: "{{ rke2_install_script_dir }}/rke2.sh"
52+
mode: 0700
53+
timeout: 30
4854
rescue:
49-
- name: "Remote downloading failed: Downloading locally and pushing to remote hosts"
55+
- name: "Remote downloading failed: Downloading locally and pushing to remote hosts ( airgap mode - download locally and push to remote )"
5056
ansible.builtin.pause: # Slight delay to make sure you know it's gonna happen and have time to cancel
5157
seconds: 7
52-
- name: "Create {{ rke2_airgap_copy_sourcepath }}"
58+
- name: "Create directory {{ rke2_airgap_copy_sourcepath }}"
5359
delegate_to: localhost
5460
run_once: true
5561
ansible.builtin.file:
5662
path: "{{ rke2_airgap_copy_sourcepath }}"
5763
state: directory
58-
mode: 0700
64+
mode: 0750
65+
owner: "{{ lookup('env', 'USER') }}"
5966
- name: Download RKE2 checksum locally
6067
delegate_to: localhost
6168
run_once: true
@@ -65,6 +72,7 @@
6572
dest: "{{ rke2_airgap_copy_sourcepath }}/"
6673
force: yes
6774
mode: 0640
75+
owner: "{{ lookup('env', 'USER') }}"
6876
timeout: 30
6977
- name: Downloading RKE2 artifacts locally
7078
delegate_to: localhost
@@ -74,17 +82,26 @@
7482
url: "{{ item }}"
7583
dest: "{{ rke2_airgap_copy_sourcepath }}/"
7684
mode: 0640
77-
with_items: "{{ [rke2_artifact_url+'/'+rke2_version+'/'] | product(rke2_artifact) | map('join') | list + [rke2_install_bash_url] }}"
85+
owner: "{{ lookup('env', 'USER') }}"
86+
with_items: "{{ [rke2_artifact_url + '/' + rke2_version + '/'] | product(rke2_artifact) | map('join') | list + [rke2_install_bash_url] }}"
87+
- name: Download RKE2 install script locally
88+
delegate_to: localhost
89+
run_once: true
90+
ansible.builtin.get_url:
91+
url: "{{ rke2_install_bash_url }}"
92+
dest: "{{ rke2_airgap_copy_sourcepath }}/rke2.sh"
93+
mode: 0700
94+
owner: "{{ lookup('env', 'USER') }}"
7895
- name: Copy local RKE2 files to remote hosts
7996
ansible.builtin.copy:
80-
src: "{{ rke2_airgap_copy_sourcepath }}/{{ item }}"
81-
dest: "{{ rke2_artifact_path }}/{{ item }}"
97+
src: "{{ rke2_airgap_copy_sourcepath }}/"
98+
dest: "{{ rke2_artifact_path }}/"
8299
mode: 0640
83-
with_items: "{{ rke2_artifacts + ['rke2.sh'] }}"
84-
- name: Set RKE2 install script permissions
85-
ansible.builtin.file:
86-
path: "{{ rke2_artifact_path }}/rke2.sh"
87-
mode: 0750
100+
- name: Copy local RKE2 install script to remote hosts
101+
ansible.builtin.copy:
102+
src: "{{ rke2_airgap_copy_sourcepath }}/rke2.sh"
103+
dest: "{{ rke2_install_script_dir }}/rke2.sh"
104+
mode: 0700
88105

89106
- name: Copy local RKE2 artifacts
90107
ansible.builtin.copy:

0 commit comments

Comments
 (0)