-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s_setup.yml
74 lines (71 loc) · 2.22 KB
/
k8s_setup.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
# Define values to ansible distrib, version, family facts
- name: Define values to ansible distrib, version, family facts
hosts: all
# remote_user: <user>
become: yes
become_method: sudo
gather_facts: yes
tags: ["always", ver]
tasks:
# Set facts (as example facts from Astra Linux 1.7 and CentOS 8)
- name: Set fact - os_distrib_version
set_fact:
os_distrib_version: "{{ ansible_distribution | replace(' ', '') | lower }}{{ ansible_distribution_major_version | lower}}" # "astralinux1" "centos8"
- name: Set fact - os_family_version
set_fact:
os_family_version: "{{ ansible_os_family | replace(' ', '') | lower }}{{ ansible_distribution_major_version | lower }}" # "astralinux1" "redhat8"
- name: Set fact - os_distrib_version
set_fact:
os_distrib: "{{ ansible_distribution | replace(' ', '') | lower }}" # "astralinux" "centos"
- name: Set fact - os_family_version
set_fact:
os_family: "{{ ansible_os_family | replace(' ', '') | lower }}" # "astralinux" "redhat"
- name: Print os_distrib_version
ansible.builtin.debug:
msg: os_distrib_version = {{ os_distrib_version }}
# OS Prepare
- name: OS Prepare
hosts: all
# remote_user: <user>
become: yes
become_method: sudo
gather_facts: no
pre_tasks:
- name: include OS specific vars
include_vars: "{{ playbook_dir }}/vars/{{ os_distrib_version }}.yml"
tags: ["always"]
roles:
- role: os-prepare
when: os_prepare
tags: os_prep
# Kubernetes Setup
- name: Kubernetes Setup
hosts: kube_masters:kube_not_masters
# remote_user: <user>
become: yes
become_method: sudo
gather_facts: no
pre_tasks:
- name: include OS specific vars
include_vars: "{{ playbook_dir }}/vars/{{ os_distrib_version }}.yml"
tags: ["always"]
roles:
- role: kubernetes-setup
when: kubernetes_setup
tags: kube_set
# HA Setup
- name: HA Setup
hosts: kube_masters
# remote_user: <user>
become: yes
become_method: sudo
gather_facts: no
pre_tasks:
- name: include OS specific vars
include_vars: "{{ playbook_dir }}/vars/{{ os_distrib_version }}.yml"
tags: ["always"]
roles:
- role: ha-setup
when: ha_setup
tags: ha_set