This commit is contained in:
cătălin 2024-02-10 19:44:11 +01:00
commit 1cc30ed503
Signed by untrusted user: catalin
GPG key ID: 0178DF42F43E5FD2
15 changed files with 202 additions and 1 deletions

View file

@ -0,0 +1,17 @@
---
- name: Create rancher folder
file:
state: directory
path: /etc/rancher/k3s
owner: root
group: root
mode: 755
- name: Copy k3s config file
template:
src: agent.config.yaml.j2
dest: /etc/rancher/k3s/config.yaml
mode: 600
- name: Install k3s agent
shell: "bash /tmp/k3s.install.sh agent"

View file

@ -0,0 +1,19 @@
---
- name: Create .kube directory
become: yes
file:
path: /home/ci/.kube
state: directory
mode: '0755'
owner: ci
group: ci
- name: Copy kubeconfig
copy:
remote_src: true
src: /etc/rancher/k3s/k3s.yaml
dest: /home/ci/.kube/config
mode: 0644
owner: ci
group: ci
become: yes

View file

@ -0,0 +1,7 @@
---
- name: Download k3s script
get_url:
url: https://get.k3s.io
dest: /tmp/k3s.install.sh

View file

@ -0,0 +1,14 @@
- import_tasks: download.yml
name: Download install script
- import_tasks: master.yml
name: Install master node
when: inventory_hostname in groups["k3s_masters"]
- import_tasks: agent.yml
name: Install agent node
when: inventory_hostname in groups["k3s_agents"]
- import_tasks: copy-kubeconfig.yml
name: Copy kubeconfig
when: inventory_hostname in groups["k3s_masters"] and is_first_master

View file

@ -0,0 +1,19 @@
---
- name: Create rancher folder
file:
state: directory
path: /etc/rancher/k3s
owner: root
group: root
mode: 755
- name: Copy k3s config file
template:
src: master.config.yaml.j2
dest: /etc/rancher/k3s/config.yaml
mode: 600
vars:
etcd_snapshot_dir: "/nfs/nas1/backups/{{ short_hostname }}"
- name: Install k3s master
command: bash /tmp/k3s.install.sh