36 lines
968 B
YAML
36 lines
968 B
YAML
|
---
|
||
|
- hosts: all
|
||
|
gather_facts: false
|
||
|
name: install k3s server
|
||
|
tasks:
|
||
|
- name: download k3s install script
|
||
|
ansible.builtin.get_url:
|
||
|
url: https://get.k3s.io
|
||
|
dest: /usr/local/bin/k3s_install.sh
|
||
|
mode: 0755
|
||
|
- name: install k3s server
|
||
|
ansible.builtin.command: "k3s_install.sh"
|
||
|
environment:
|
||
|
INSTALL_K3S_EXEC: "--disable traefik"
|
||
|
changed_when: false
|
||
|
- name: start and enable k3s server
|
||
|
ansible.builtin.service:
|
||
|
name: k3s
|
||
|
state: started
|
||
|
enabled: true
|
||
|
- name: add kubeconfig variable to bashrc
|
||
|
ansible.builtin.lineinfile:
|
||
|
path: ~/.bashrc
|
||
|
line: "export KUBECONFIG=/etc/rancher/k3s/k3s.yaml"
|
||
|
insertafter: EOF
|
||
|
|
||
|
- hosts: all
|
||
|
gather_facts: false
|
||
|
name: deploy baseline
|
||
|
tasks:
|
||
|
- name: copy manifest
|
||
|
ansible.builtin.copy:
|
||
|
src: init.yml
|
||
|
dest: /var/lib/rancher/k3s/server/manifests/init-baseline.yml
|
||
|
mode: 0644
|