diff options
Diffstat (limited to 'terraform/ansible/roles/k3s/tasks')
-rw-r--r-- | terraform/ansible/roles/k3s/tasks/main.yml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/terraform/ansible/roles/k3s/tasks/main.yml b/terraform/ansible/roles/k3s/tasks/main.yml new file mode 100644 index 0000000..0b7797a --- /dev/null +++ b/terraform/ansible/roles/k3s/tasks/main.yml @@ -0,0 +1,39 @@ +- include_vars: + file: k3s_releases.yml + +- get_url: + url: "{{ k3s__releases[k3s_version][item].url }}" + dest: /usr/local/bin/k3s + checksum: "sha256:{{ k3s__releases[k3s_version][item].checksum }}" + mode: ugo=rx + + with_items: + - k3s + notify: systemctl restart k3s + +- template: + src: "k3s.service.j2" + dest: "/etc/systemd/system/k3s.service" + notify: systemctl restart k3s + +- systemd: + unit: k3s + daemon_reload: yes + enabled: yes + +- meta: flush_handlers + +- when: k3s_role == 'master' + block: + - name: Wait for node-token + wait_for: + path: /var/lib/rancher/k3s/server/node-token + + - name: Read node-token from master + slurp: + src: /var/lib/rancher/k3s/server/node-token + register: node_token + + - name: Store Master node-token + set_fact: + node_token: "{{ node_token.content | b64decode | regex_replace('\n', '') }}" |