-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path70_k3s.yml
57 lines (53 loc) · 1.38 KB
/
70_k3s.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
- hosts: k3s
become: true
any_errors_fatal: true
roles:
- k3s-prereq
- k3s-download
tasks:
- name: Install legacy iptables
package:
name: iptables
state: present
- name: Use legacy iptables on debian systems
alternatives:
name: iptables
path: /usr/sbin/iptables-legacy
when: ansible_os_family == 'Debian'
- name: Assert S3 variables are set
ansible.builtin.assert:
that:
- k3s_etcd_s3_access_key != ''
- k3s_etcd_s3_secret_key != ''
- hosts: k3s_control_plane
become: true
serial: 1
any_errors_fatal: true
roles:
- k3s-master
tasks:
- name: Get kube config to deployer host
fetch:
src: "/etc/rancher/k3s/k3s.yaml"
dest: "{{ playbook_dir }}/kubeconfig"
flat: true
run_once: true
- name: Replace localhost with master IP
become: false
replace:
path: "{{ playbook_dir }}/kubeconfig"
regexp: "127.0.0.1"
replace: "{{ k3s_master_ip }}"
delegate_to: localhost
run_once: true
- name: Import manifests bound to infrastructure
template:
src: "{{ item }}"
dest: "/var/lib/rancher/k3s/server/manifests/{{ item | basename | regex_replace('\\.j2$', '') }}"
with_fileglob: "templates/manifests/*.yaml.j2"
- hosts: k3s_nodes
become: true
serial: 2
roles:
- k3s-node