Added k3s agents

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2024-09-20 16:57:59 +02:00
parent 3aa56be025
commit 8fb4eaf610
13 changed files with 157 additions and 42 deletions

View File

@@ -0,0 +1,6 @@
---
- name: Restart k3s
service:
name: k3s
state: restarted
become: yes

View File

@@ -0,0 +1,21 @@
---
- name: See if k3s file exists
stat:
path: /usr/local/bin/k3s
register: k3s_status
- name: Download K3s install script to /tmp/
when: not k3s_status.stat.exists
ansible.builtin.get_url:
url: https://get.k3s.io
dest: /tmp/k3s_install.sh
mode: "0755"
- name: Install K3s on the secondary servers
when: not k3s_status.stat.exists
command: |
/tmp/k3s_install.sh
environment:
K3S_URL: "https://{{ k3s.loadbalancer.ip }}:{{k3s.loadbalancer.default_port}}"
K3S_TOKEN: "{{ k3s_token }}"
become: true

View File

@@ -0,0 +1,2 @@
---
- include_tasks: installation.yml