Added k3s agents
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
6
roles/k3s_agent/handlers/main.yml
Normal file
6
roles/k3s_agent/handlers/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Restart k3s
|
||||
service:
|
||||
name: k3s
|
||||
state: restarted
|
||||
become: yes
|
||||
21
roles/k3s_agent/tasks/installation.yml
Normal file
21
roles/k3s_agent/tasks/installation.yml
Normal 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
|
||||
2
roles/k3s_agent/tasks/main.yml
Normal file
2
roles/k3s_agent/tasks/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
- include_tasks: installation.yml
|
||||
Reference in New Issue
Block a user