|
1 | 1 | --- |
2 | 2 | - name: Get k3s installed version |
3 | 3 | ansible.builtin.command: k3s --version |
4 | | - register: k3s_version_output |
| 4 | + register: k3s_agent_version_output |
5 | 5 | changed_when: false |
6 | 6 | ignore_errors: true |
7 | 7 |
|
8 | 8 | - name: Set k3s installed version |
9 | | - when: not ansible_check_mode and k3s_version_output.rc == 0 |
| 9 | + when: not ansible_check_mode and k3s_agent_version_output.rc == 0 |
10 | 10 | ansible.builtin.set_fact: |
11 | | - installed_k3s_version: "{{ k3s_version_output.stdout_lines[0].split(' ')[2] }}" |
| 11 | + k3s_agent_installed_version: "{{ k3s_agent_version_output.stdout_lines[0].split(' ')[2] }}" |
12 | 12 |
|
13 | 13 | # If airgapped, all K3s artifacts are already on the node. |
14 | 14 | # We should be downloading and installing the newer version only if we are in one of the following cases : |
15 | 15 | # - we couldn't get k3s installed version in the first task of this role |
16 | 16 | # - the installed version of K3s on the nodes is older than the requested version in ansible vars |
17 | 17 | - name: Download artifact only if needed |
18 | | - when: not ansible_check_mode and airgap_dir is undefined and ( k3s_version_output.rc != 0 or installed_k3s_version is version(k3s_version, '<') ) |
| 18 | + when: not ansible_check_mode and airgap_dir is undefined and ( k3s_agent_version_output.rc != 0 or k3s_agent_installed_version is version(k3s_version, '<') ) |
19 | 19 | block: |
20 | 20 | - name: Download K3s install script |
21 | 21 | ansible.builtin.get_url: |
|
50 | 50 | mode: "0755" |
51 | 51 | state: directory |
52 | 52 | - name: Copy config values |
| 53 | + # noqa var-naming[no-role-prefix] |
53 | 54 | ansible.builtin.copy: |
54 | 55 | content: "{{ agent_config_yaml }}" |
55 | 56 | dest: "/etc/rancher/k3s/config.yaml" |
56 | 57 | mode: "0644" |
57 | 58 | register: _agent_config_result |
58 | 59 |
|
59 | 60 | - name: Get the token from the first server |
| 61 | + # noqa var-naming[no-role-prefix] |
60 | 62 | ansible.builtin.set_fact: |
61 | 63 | token: "{{ hostvars[groups[server_group][0]].token }}" |
62 | 64 |
|
|
0 commit comments