infra/ansible/roles/k3s/tasks/get_k3s.yml

73 lines
1.4 KiB
YAML

---
- name: get dependencies
apt:
name:
- apparmor
- apparmor-utils
- nfs-common
- open-iscsi
- name: check k3s version
shell:
cmd: "k3s --version | grep k3s | cut -d' ' -f3"
args:
executable: /bin/bash
changed_when: False
register: installed_k3s_version
check_mode: False
- name: get k3s
get_url:
url: "https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/k3s-arm64"
dest: /usr/local/bin/k3s
mode: 0755
owner: root
group: root
force: True
when: installed_k3s_version.stdout != k3s_version
notify: restart k3s
- name: link k3s
file:
src: /usr/local/bin/k3s
dest: /usr/local/bin/kubernetes
state: link
- name: ensure k3s directory
file:
path: /etc/rancher/k3s
state: directory
owner: root
group: root
mode: 0755
- name: copy registries file
copy:
src: files/registries.yaml
dest: /etc/rancher/k3s/registries.yaml
owner: root
group: root
mode: 0644
- name: ensure mount is configured
ansible.posix.mount:
path: /mnt/storage
src: /dev/nvme0n1p1
fstype: ext4
state: mounted
when: kube_storage
- name: ensure cryptsetup is installed
apt:
name: cryptsetup
state: present
when: kube_storage
- name: ensure dm_crypt is loaded
modprobe:
name: dm_crypt
state: present
persistent: present
when: kube_storage
...