File tree Expand file tree Collapse file tree 2 files changed +30
-22
lines changed Expand file tree Collapse file tree 2 files changed +30
-22
lines changed Original file line number Diff line number Diff line change 1
- k3s_version : " v1.31.0+k3s1"
1
+ k3s_version : " v1.31.0+k3s1" # Warning: changes to this variable won't be reflected in the cluster/image if k3s is already installed
Original file line number Diff line number Diff line change 1
1
---
2
2
3
- - name : Download k3s install script
4
- ansible.builtin.get_url :
5
- url : https://get.k3s.io/
6
- timeout : 120
7
- dest : /usr/bin/k3s-install.sh
8
- owner : root
9
- group : root
10
- mode : " 0755"
3
+ - name : Check for existing k3s binaries
4
+ stat :
5
+ path : /usr/bin/k3s
6
+ register : stat_result
7
+
8
+ - name : Download and install k3s
9
+ when : not stat_result.stat.exists
10
+ block :
11
+ - name : Download k3s install script
12
+ ansible.builtin.get_url :
13
+ url : https://get.k3s.io/
14
+ timeout : 120
15
+ dest : /usr/bin/k3s-install.sh
16
+ owner : root
17
+ group : root
18
+ mode : " 0755"
11
19
12
- - name : Install k3s
13
- ansible.builtin.shell :
14
- cmd : /usr/bin/k3s-install.sh
15
- environment :
16
- INSTALL_K3S_VERSION : " {{ k3s_version }}"
17
- INSTALL_K3S_EXEC : " {{ item }}"
18
- INSTALL_K3S_SKIP_START : " true"
19
- INSTALL_K3S_SKIP_ENABLE : " true"
20
- INSTALL_K3S_BIN_DIR : " /usr/bin"
21
- changed_when : true
22
- loop :
23
- - server
24
- - agent
20
+ - name : Install k3s
21
+ ansible.builtin.shell :
22
+ cmd : /usr/bin/k3s-install.sh
23
+ environment :
24
+ INSTALL_K3S_VERSION : " {{ k3s_version }}"
25
+ INSTALL_K3S_EXEC : " {{ item }}"
26
+ INSTALL_K3S_SKIP_START : " true"
27
+ INSTALL_K3S_SKIP_ENABLE : " true"
28
+ INSTALL_K3S_BIN_DIR : " /usr/bin"
29
+ changed_when : true
30
+ loop :
31
+ - server
32
+ - agent
25
33
26
34
- name : Install helm
27
35
unarchive :
You can’t perform that action at this time.
0 commit comments