-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.yml
144 lines (130 loc) · 3.57 KB
/
site.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
# This playbook should deploy everything
- name: Site playbook
hosts: all
tags:
- always
tasks:
- name: Ensure required variables have been defined
ansible.builtin.assert:
quiet: true
fail_msg: Required variable has not been defined
that:
- maas_url is defined
- maas_version is defined
- maas_installation_type is defined
- maas_postgres_password is defined
- name: Ensure maas_version is a version string
ansible.builtin.assert:
fail_msg: "'{{ maas_version }}' is not a valid version number"
that:
- maas_version is regex('\d+\.\d+(\.\d+)?')
- name: Define proxy environment if proxies given
ansible.builtin.set_fact:
proxy_env: "{{ proxy_env | combine({'http_proxy': http_proxy | d(omit)}) | combine({'https_proxy': https_proxy | d(omit)}) }}"
- name: Show proxy environment if in use
ansible.builtin.debug:
msg: "Playbooks using proxy settings: {{ proxy_env }}"
with_dict: "{{ proxy_env }}"
- name: Ensure dist is up to date
ansible.builtin.apt:
upgrade: dist
update_cache: true
cache_valid_time: 3600
become: true
- name: Discover host architecture
ansible.builtin.command: dpkg --print-architecture
register: arch_out
changed_when: false
- name: Set architechture facts
ansible.builtin.set_fact:
ubuntu_arch: "{{ arch_out.stdout }}"
- name: Build postgres
hosts: maas_postgres
roles:
- role: maas_postgres
become: true
gather_facts: true
tags:
- maas_postgres_primary
- maas_postgres_secondary
- maas_postgres
- maas_ha_postgres
environment: "{{ proxy_env }}"
- name: Build Corrosync
hosts: maas_corosync
roles:
- role: maas_corosync
become: true
gather_facts: true
tags:
- maas_corosync
- maas_ha_postgres
environment: "{{ proxy_env }}"
- name: Build pacemakers
hosts: maas_pacemaker
roles:
- role: maas_pacemaker
become: true
gather_facts: true
tags:
- maas_pacemaker
- maas_ha_postgres
environment: "{{ proxy_env }}"
- name: Build postgres proxies
hosts: maas_postgres_proxy
roles:
- role: maas_postgres_proxy
become: true
gather_facts: true
tags:
- maas_postgres_proxy
environment: "{{ proxy_env }}"
# proxies are provisioned prior to rack controllers so the rack controller
# will request to register to region controllers through the proxy
- name: Build MAAS proxies
hosts: maas_proxy
roles:
- role: maas_proxy
become: true
gather_facts: true
tags:
- maas_proxy
environment: "{{ proxy_env }}"
- name: Build region controllers
hosts: maas_region_controller
roles:
- role: maas_region_controller
become: true
gather_facts: true
tags:
- maas_region_controller
- maas_controller
environment: "{{ proxy_env }}"
- name: Build rack controllers
hosts: maas_rack_controller
roles:
- role: maas_rack_controller
become: true
gather_facts: true
tags:
- maas_rack_controller
- maas_controller
environment: "{{ proxy_env }}"
- name: Configure observability
hosts: maas_rack_controller, maas_region_controller, maas_postgres
become: true
gather_facts: true
tags:
- maas_o11y
environment: "{{ proxy_env }}"
pre_tasks:
- name: Ensure o11y can be enabled
ansible.builtin.assert:
quiet: true
fail_msg: Prometheus or Loki endpoints must be defined
that:
- (o11y_prometheus_url|length > 0 or o11y_loki_url|length > 0)
when: o11y_enable
roles:
- role: o11y_agent