2022-04-10 08:56:42 +00:00
|
|
|
---
|
|
|
|
- hosts: all
|
|
|
|
gather_facts: false
|
2023-07-17 09:31:21 +00:00
|
|
|
name: Install k3s server
|
2023-06-26 08:37:09 +00:00
|
|
|
tags: k3s-server
|
2022-04-10 08:56:42 +00:00
|
|
|
tasks:
|
2023-07-17 09:31:21 +00:00
|
|
|
- name: Download k3s install script
|
2022-04-10 08:56:42 +00:00
|
|
|
ansible.builtin.get_url:
|
|
|
|
url: https://get.k3s.io
|
|
|
|
dest: /usr/local/bin/k3s_install.sh
|
2023-07-17 09:31:21 +00:00
|
|
|
mode: "755"
|
|
|
|
- name: Install k3s server
|
2022-04-10 08:56:42 +00:00
|
|
|
ansible.builtin.command: "k3s_install.sh"
|
|
|
|
environment:
|
2024-02-07 02:00:55 +00:00
|
|
|
INSTALL_K3S_CHANNEL: v1.29.1+k3s2
|
2022-04-10 08:56:42 +00:00
|
|
|
INSTALL_K3S_EXEC: "--disable traefik"
|
|
|
|
changed_when: false
|
2023-07-17 09:31:21 +00:00
|
|
|
- name: Start and enable k3s server
|
2022-04-10 08:56:42 +00:00
|
|
|
ansible.builtin.service:
|
|
|
|
name: k3s
|
|
|
|
state: started
|
|
|
|
enabled: true
|
2023-07-17 09:31:21 +00:00
|
|
|
- name: Get kubeconfig
|
|
|
|
ansible.builtin.fetch:
|
2022-05-01 07:55:05 +00:00
|
|
|
src: /etc/rancher/k3s/k3s.yaml
|
|
|
|
dest: kubeconfig_{{ ansible_host }}.yml
|
2023-06-26 08:37:09 +00:00
|
|
|
flat: true
|
2022-04-10 08:56:42 +00:00
|
|
|
|
|
|
|
- hosts: all
|
|
|
|
gather_facts: false
|
2023-07-17 09:31:21 +00:00
|
|
|
name: Deploy baseline
|
2023-06-26 08:37:09 +00:00
|
|
|
tags: baseline
|
2022-04-10 08:56:42 +00:00
|
|
|
tasks:
|
2023-07-17 09:31:21 +00:00
|
|
|
- name: Copy manifest
|
2022-04-10 08:56:42 +00:00
|
|
|
ansible.builtin.copy:
|
2022-04-30 13:07:08 +00:00
|
|
|
src: argocd-init.yml
|
|
|
|
dest: /var/lib/rancher/k3s/server/manifests/argocd-init.yml
|
2023-07-17 09:31:21 +00:00
|
|
|
mode: "644"
|