-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathinit.sls
More file actions
322 lines (274 loc) · 8.24 KB
/
Copy pathinit.sls
File metadata and controls
322 lines (274 loc) · 8.24 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
include:
- repos
- controller.apache_https
{% set ruby_version = '3.4' if grains['osrelease'] == '16.0' else '3.3' %}
# WORKAROUND: remove once healthcheck is available for Leap 16 too.
# Right now Tumbleweed has a version for which we can satisfy the dependencies
{% set healthcheck_os = 'openSUSE_Tumbleweed' if grains['osrelease'] == '16.0' else grains['osrelease'] %}
ssh_private_key:
file.managed:
- name: /root/.ssh/id_ed25519
- source: salt://controller/id_ed25519
- makedirs: True
- user: root
- group: root
- mode: 700
ssh_public_key:
file.managed:
- name: /root/.ssh/id_ed25519.pub
- source: salt://controller/id_ed25519.pub
- makedirs: True
- user: root
- group: root
- mode: 700
authorized_keys_controller:
file.append:
- name: /root/.ssh/authorized_keys
- source: salt://controller/id_ed25519.pub
- makedirs: True
cucumber_requisites:
pkg.installed:
- pkgs:
- gcc
- make
- wget
- ruby{{ ruby_version }}
- ruby{{ ruby_version }}-devel
- ca-certificates-mozilla
- apache2-worker
- cantarell-fonts
- git-core
- aaa_base-extras
- mozilla-nss-tools
- unzip
- require:
- sls: repos
/usr/bin/ruby:
file.symlink:
- target: /usr/bin/ruby.ruby{{ ruby_version }}
- force: True
/usr/bin/gem:
file.symlink:
- target: /usr/bin/gem.ruby{{ ruby_version }}
- force: True
/usr/bin/irb:
file.symlink:
- target: /usr/bin/irb.ruby{{ ruby_version }}
- force: True
ruby_set_rake_version:
cmd.run:
- name: update-alternatives --set rake /usr/bin/rake.ruby.ruby{{ ruby_version }}
ruby_set_bundle_version:
cmd.run:
- name: update-alternatives --set bundle /usr/bin/bundle.ruby.ruby{{ ruby_version }}
ruby_set_rdoc_version:
cmd.run:
- name: update-alternatives --set rdoc /usr/bin/rdoc.ruby.ruby{{ ruby_version }}
ruby_set_ri_version:
cmd.run:
- name: update-alternatives --set ri /usr/bin/ri.ruby.ruby{{ ruby_version }}
# Distro Chromium is kept ONLY to provide the shared libraries (libgbm, NSS, fonts, ...)
# that the Playwright-managed Chromium needs. It is not the browser Playwright launches.
install_chromium:
pkg.installed:
- name: chromium
# --- Playwright (replaces chromedriver) -------------------------------------
install_npm:
pkg.installed:
- name: npm-default
# Node Playwright CLI + driver. Must match playwright-ruby-client (1.60.0).
install_playwright_cli:
cmd.run:
- name: npm install -g playwright@1.60.0
- unless: test -x /usr/local/bin/playwright
- require:
- pkg: install_npm
# Download the CDP-matched Chromium build managed by Playwright (into /root/.cache/ms-playwright).
# Do NOT add --with-deps: unsupported on openSUSE/zypper. OS libs come from the chromium pkg above.
playwright_install_chromium:
cmd.run:
- name: /usr/local/bin/playwright install chromium
- env:
- HOME: /root
- creates: /root/.cache/ms-playwright
- require:
- cmd: install_playwright_cli
- pkg: install_chromium
# Point playwright-ruby-client at the global CLI for every login shell.
playwright_cli_env:
file.managed:
- name: /etc/profile.d/playwright.sh
- mode: 644
- contents: |
export PLAYWRIGHT_CLI_EXECUTABLE_PATH=/usr/local/bin/playwright
# ----------------------------------------------------------------------------
install_gems_via_bundle:
cmd.run:
- name: bundle.ruby.ruby{{ ruby_version }} install --gemfile Gemfile
- cwd: /root/spacewalk/testsuite
- require:
- pkg: cucumber_requisites
- cmd: spacewalk_git_repository
# https://github.com/WasiqB/multiple-cucumber-html-reporter
# Replaces cucumber-html-reporter
# Preserves JSON execution order, supports filter by passed/failed/skipped
install_multiple_cucumber_html_reporter_via_npm:
cmd.run:
- name: npm install multiple-cucumber-html-reporter@3.7.0 --save-dev
- require:
- pkg: install_npm
git_config:
file.append:
- name: ~/.netrc
- text: |
{%- if grains.get("git_username") and grains.get("git_password") %}
machine github.com
login {{ grains.get("git_username") }}
password {{ grains.get("git_password") }}
protocol https
{%- endif %}
netrc_mode:
file.managed:
- name: ~/.netrc
- user: root
- group: root
- mode: 600
- replace: False
- require:
- file: git_config
spacewalk_git_repository:
cmd.run:
{%- set url = grains.get('git_repo') | default('default', true) %}
{%- set branch = grains.get('branch') | default('master', true) %}
{%- if url == 'default' %}
{%- if branch == 'master' %}
{%- set url = 'https://github.com/uyuni-project/uyuni.git' %}
{%- else %}
{%- set url = 'https://github.com/SUSE/spacewalk.git' %}
{%- endif %}
{%- endif %}
- name: |
git clone --depth 100 --no-checkout --branch {{ branch }} {{ url }} /root/spacewalk
cd /root/spacewalk
git sparse-checkout init --cone
git sparse-checkout set testsuite
git checkout
- creates: /root/spacewalk
- require:
- pkg: cucumber_requisites
- file: netrc_mode
cucumber_run_script:
file.managed:
- name: /usr/bin/run-testsuite
- source: salt://controller/run-testsuite
- template: jinja
- user: root
- group: root
- mode: 755
testsuite_env_vars:
file.managed:
- name: /root/.bashrc
- source: salt://controller/bashrc
- template: jinja
- user: root
- group: root
- mode: 755
extra_pkgs:
pkg.installed:
- pkgs:
- screen
- xauth
- require:
- sls: repos
# needed together with the `xauth` package for debugging with Playwright in non-headless mode with `export DEBUG=1`
create_xauthority_file:
cmd.run:
- name: touch /root/.Xauthority
chrome_certs:
file.directory:
- user: root
- name: /root/.pki/nssdb
- group: users
- mode: 755
- makedirs: True
google_cert_db:
cmd.run:
- name: certutil -d sql:/root/.pki/nssdb -N --empty-password
- require:
- file: chrome_certs
- creates: /root/.pki/nssdb
# Health-check testing
health_check_repo:
pkgrepo.managed:
- baseurl: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:/Uyuni:/healthcheck:/Stable/{{ healthcheck_os }}
- gpgkey: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:/Uyuni:/healthcheck:/Stable/{{ healthcheck_os }}/repodata/repomd.xml.key
- gpgcheck: 0
- refresh: True
install_health_check:
pkg.installed:
- name: mgr-health-check
- resolve_capabilities: True
- require:
- pkgrepo: health_check_repo
# NFS mounted partition to store reports in a external Web Server
{% if grains.get('web_server_hostname') %}
nfs_client:
pkg.installed:
- name: nfs-client
non_empty_fstab:
file.managed:
- name: /etc/fstab
- replace: false
web_server_directory:
mount.mounted:
- name: /mnt/www
- device: {{ grains.get('web_server_hostname') }}:/srv/www/htdocs
- fstype: nfs
- mkmnt: True
- require:
- file: /etc/fstab
- pkg: nfs_client
{% endif %}
node_exporter:
pkg.installed:
- name: golang-github-prometheus-node_exporter
- require:
- sls: repos
node_exporter_service:
service.running:
- name: prometheus-node_exporter
- enable: True
- require:
- pkg: node_exporter
augment_ulimits:
file.managed:
- name: /etc/security/limits.conf
- source: salt://controller/limits.conf
augment_mmaps:
file.managed:
- name: /etc/sysctl.conf
- source: salt://controller/sysctl.conf
cmd.run:
- name: sysctl -p
{% if grains.get('install_kubectl_helm') == true %}
install_kubectl:
pkg.installed:
- name: kubernetes-client
install_helm_on_controller:
cmd.run:
- name: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4 | bash
- unless: command -v helm
{% endif %}
{% if grains.get('kubeconfig_content') %}
kube_directory:
file.directory:
- name: /root/.kube
- user: root
- group: root
- mode: 700
write_kubeconfig:
cmd.run:
- name: 'printf "%s" "{{ grains.get("kubeconfig_content") }}" | base64 -d > /root/.kube/config && chmod 600 /root/.kube/config'
- require:
- file: kube_directory
{% endif %}