From a21ab3673eb92c1a20471865ecc0f0a0343b093b Mon Sep 17 00:00:00 2001 From: Massaki Archambault Date: Mon, 27 Dec 2021 23:01:35 -0500 Subject: [PATCH] switch k3s-w3 to a vm --- hosts | 2 +- roles/bastion/tasks/main.yml | 4 ++-- roles/k3s-server/tasks/main.yml | 11 +---------- roles/k3s/tasks/lxc.yml | 3 +++ roles/k3s/tasks/vm.yml | 9 +++++++++ 5 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 roles/k3s/tasks/vm.yml diff --git a/hosts b/hosts index 078b1b3..1003578 100644 --- a/hosts +++ b/hosts @@ -60,7 +60,7 @@ all: platform: raspberrypi k3s-w3: ansible_host: 192.168.20.24 - platform: lxc + platform: vm k3s_extra_args: --node-taint kubernetes.io/arch=amd64:PreferNoSchedule debian: hosts: diff --git a/roles/bastion/tasks/main.yml b/roles/bastion/tasks/main.yml index ad1d6da..bd7b333 100644 --- a/roles/bastion/tasks/main.yml +++ b/roles/bastion/tasks/main.yml @@ -23,12 +23,12 @@ lineinfile: path: /etc/ssh/sshd_config regexp: '^#?ClientAliveInterval' - line: ClientAliveInterval 5m + line: '#ClientAliveInterval 5m' notify: Restart sshd - name: Configure sshd ClientAliveCountMax lineinfile: path: /etc/ssh/sshd_config regexp: '^#?ClientAliveCountMax' - line: ClientAliveCountMax 3 + line: '#ClientAliveCountMax 3' notify: Restart sshd diff --git a/roles/k3s-server/tasks/main.yml b/roles/k3s-server/tasks/main.yml index fad4f18..62eafb3 100644 --- a/roles/k3s-server/tasks/main.yml +++ b/roles/k3s-server/tasks/main.yml @@ -38,6 +38,7 @@ dest: ~/.kube/config remote_src: yes mode: "u=rw,g=,o=" + changed_when: no # TODO - name: Set kubeconfig server ip command: >- @@ -57,13 +58,3 @@ src: /usr/local/bin/k3s dest: /usr/local/bin/crictl state: link - -# - name: Create longhorn install directory -# file: -# path: /var/lib/rancher/k3s/server/manifests/longhorn -# state: directory - -# - name: Install longhorn -# get_url: -# url: https://raw.githubusercontent.com/longhorn/longhorn/v1.2.0/deploy/longhorn.yaml -# dest: /var/lib/rancher/k3s/server/manifests/longhorn/longhorn.yaml diff --git a/roles/k3s/tasks/lxc.yml b/roles/k3s/tasks/lxc.yml index 3762cbf..6fa7198 100644 --- a/roles/k3s/tasks/lxc.yml +++ b/roles/k3s/tasks/lxc.yml @@ -1,3 +1,6 @@ +# warning: iscsi is incompatible with lxc! +# https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1226855 + - name: Download amd64 k3s binary get_url: url: https://github.com/k3s-io/k3s/releases/download/{{ k3s.version }}/k3s diff --git a/roles/k3s/tasks/vm.yml b/roles/k3s/tasks/vm.yml new file mode 100644 index 0000000..3d14a28 --- /dev/null +++ b/roles/k3s/tasks/vm.yml @@ -0,0 +1,9 @@ +- name: Download amd64 k3s binary + get_url: + url: https://github.com/k3s-io/k3s/releases/download/{{ k3s.version }}/k3s + checksum: sha256:https://github.com/k3s-io/k3s/releases/download/{{ k3s.version }}/sha256sum-amd64.txt + dest: /usr/local/bin/k3s + owner: root + group: root + mode: 0755 + notify: reboot