From 0182fe51736e7610d4a63fe6767d08ffe5c5938c Mon Sep 17 00:00:00 2001 From: clyhtsuriva Date: Mon, 3 Mar 2025 21:20:59 +0100 Subject: ansible: add dynamic inventory & playbooks to install k3s hosts bootstrap.yml will now be used to install any configuration on new provisionned servers, based on tags given by the dynamic inventory --- ansible/roles/k8s/tasks/install_k3s_master.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ansible/roles/k8s/tasks/install_k3s_master.yml (limited to 'ansible/roles/k8s/tasks/install_k3s_master.yml') diff --git a/ansible/roles/k8s/tasks/install_k3s_master.yml b/ansible/roles/k8s/tasks/install_k3s_master.yml new file mode 100644 index 0000000..71d880e --- /dev/null +++ b/ansible/roles/k8s/tasks/install_k3s_master.yml @@ -0,0 +1,20 @@ +--- +- name: Download k3s installer + ansible.builtin.get_url: + url: https://get.k3s.io + dest: /tmp/install_k3s.sh + mode: '0755' + +- name: Install k3s server + ansible.builtin.command: /tmp/install_k3s.sh server --cluster-init + become: true + +- name: Retrieve k3s token + ansible.builtin.slurp: + path: /var/lib/rancher/k3s/server/node-token + register: k3s_token_file + +- name: Set k3s token as a fact, for workers + ansible.builtin.set_fact: + k3s_token: "{{ k3s_token_file.content | b64decode }}" +... -- cgit v1.2.3