2024-03-26 15:14:23 +01:00

42 lines
887 B
YAML

- name: Prerequisites
include_tasks: prerequisites.yml
- name: Download k3s install script
get_url:
url: https://get.k3s.io
dest: /tmp/install-k3s.sh
mode: 0755
- name: Create k3s config directory
file:
path: "/var/config/k3s"
state: directory
mode: 0755
- name: Create k3s config file
template:
src: ../templates/config.yml.j2
dest: "/var/config/k3s/config.yml"
- name: Only run uninstall script if it exists (clean install)
become: true
shell: /usr/local/bin/k3s-uninstall.sh
args:
removes: /usr/local/bin/k3s-uninstall.sh
- name: Execute k3s install script providing a config.yml
shell: "/tmp/install-k3s.sh --config /var/config/k3s/config.yml server"
- name: Copy kube config file back to local machine
fetch:
src: /etc/rancher/k3s/k3s.yaml
dest: /home/remy/.kube/config-home
flat: yes
run_once: true