diff --git a/inventories/group_vars/k3s_cluster.yml b/inventories/group_vars/k3s_cluster.yml index 62cc427..3726bc5 100644 --- a/inventories/group_vars/k3s_cluster.yml +++ b/inventories/group_vars/k3s_cluster.yml @@ -1,5 +1,6 @@ --- -k3s_version: v1.17.5+k3s1 +#k3s_version: v1.17.5+k3s1 +k3s_version: v1.21.4+k3s1 ansible_user: pi systemd_dir: /etc/systemd/system master_ip: "{{ hostvars[groups['k3s_master'][0]]['ansible_host'] | default(groups['k3s_master'][0]) }}" diff --git a/playbooks/site.yml b/playbooks/k3s_site.yml similarity index 58% rename from playbooks/site.yml rename to playbooks/k3s_site.yml index 31cc96e..86e7f7a 100644 --- a/playbooks/site.yml +++ b/playbooks/k3s_site.yml @@ -4,16 +4,16 @@ gather_facts: yes become: yes roles: - - role: prereq - - role: download - - role: raspberrypi + - role: k3s_prereq + - role: k3s_download + - role: k3s_raspberrypi -- hosts: master +- hosts: k3s_master become: yes roles: - role: k3s/master -- hosts: node +- hosts: k3s_nodes become: yes roles: - role: k3s/node diff --git a/roles/k3s/node/templates/k3s.service.j2 b/roles/k3s/node/templates/k3s.service.j2 index 99a0ac3..4e46fb3 100644 --- a/roles/k3s/node/templates/k3s.service.j2 +++ b/roles/k3s/node/templates/k3s.service.j2 @@ -7,7 +7,7 @@ After=network-online.target Type=notify ExecStartPre=-/sbin/modprobe br_netfilter ExecStartPre=-/sbin/modprobe overlay -ExecStart=/usr/local/bin/k3s agent --server https://{{ master_ip }}:6443 --token {{ hostvars[groups['master'][0]]['token'] }} {{ extra_agent_args | default("") }} +ExecStart=/usr/local/bin/k3s agent --server https://{{ master_ip }}:6443 --token {{ hostvars[groups['k3s_master'][0]]['token'] }} {{ extra_agent_args | default("") }} KillMode=process Delegate=yes # Having non-zero Limit*s causes performance problems due to accounting overhead diff --git a/roles/download/tasks/main.yml b/roles/k3s_download/tasks/main.yml similarity index 100% rename from roles/download/tasks/main.yml rename to roles/k3s_download/tasks/main.yml diff --git a/roles/prereq/tasks/main.yml b/roles/k3s_prereq/tasks/main.yml similarity index 100% rename from roles/prereq/tasks/main.yml rename to roles/k3s_prereq/tasks/main.yml diff --git a/roles/raspberrypi/handlers/main.yml b/roles/k3s_raspberrypi/handlers/main.yml similarity index 100% rename from roles/raspberrypi/handlers/main.yml rename to roles/k3s_raspberrypi/handlers/main.yml diff --git a/roles/raspberrypi/tasks/main.yml b/roles/k3s_raspberrypi/tasks/main.yml similarity index 100% rename from roles/raspberrypi/tasks/main.yml rename to roles/k3s_raspberrypi/tasks/main.yml diff --git a/roles/raspberrypi/tasks/prereq/CentOS.yml b/roles/k3s_raspberrypi/tasks/prereq/CentOS.yml similarity index 100% rename from roles/raspberrypi/tasks/prereq/CentOS.yml rename to roles/k3s_raspberrypi/tasks/prereq/CentOS.yml diff --git a/roles/raspberrypi/tasks/prereq/Raspbian.yml b/roles/k3s_raspberrypi/tasks/prereq/Raspbian.yml similarity index 87% rename from roles/raspberrypi/tasks/prereq/Raspbian.yml rename to roles/k3s_raspberrypi/tasks/prereq/Raspbian.yml index 42bfe7d..2d235ca 100644 --- a/roles/raspberrypi/tasks/prereq/Raspbian.yml +++ b/roles/k3s_raspberrypi/tasks/prereq/Raspbian.yml @@ -17,9 +17,11 @@ path: /usr/sbin/iptables-legacy name: iptables register: ip4_legacy + when: ansible_distribution_major_version|int > 9 - name: Changing to ip6tables-legacy alternatives: path: /usr/sbin/ip6tables-legacy name: ip6tables register: ip6_legacy + when: ansible_distribution_major_version|int > 9 diff --git a/roles/raspberrypi/tasks/prereq/Ubuntu.yml b/roles/k3s_raspberrypi/tasks/prereq/Ubuntu.yml similarity index 100% rename from roles/raspberrypi/tasks/prereq/Ubuntu.yml rename to roles/k3s_raspberrypi/tasks/prereq/Ubuntu.yml diff --git a/roles/raspberrypi/tasks/prereq/default.yml b/roles/k3s_raspberrypi/tasks/prereq/default.yml similarity index 100% rename from roles/raspberrypi/tasks/prereq/default.yml rename to roles/k3s_raspberrypi/tasks/prereq/default.yml