blob: fcdaf94f29082537383addbd6283b64bb31ff59a [file] [log] [blame]
Jan Kundrát1c2bb582019-01-10 19:30:43 +01001- name: Prepeare Python env
2 include_role:
3 name: el7_centos_python_env
4
Jan Kundrát031422b2019-01-14 17:11:03 +01005
6# PostgreSQL reporter from Zuul
7- name: PostgreSQL 10 packages and Python bindings
8 package:
9 name: '{{ item }}'
10 state: present
11 with_items:
12 - rh-python36-python-psycopg2
13 - rh-postgresql10-postgresql-syspaths
14 - python-psycopg2
15
16- name: PostgreSQL 10 server package
17 package:
18 name: rh-postgresql10-postgresql-server
19 state: present
20
21- name: postgresql 10 initdb
22 command: '/opt/rh/rh-postgresql10/root/usr/bin/postgresql-setup --initdb'
23 args:
24 creates: /var/opt/rh/rh-postgresql10/lib/pgsql/data/PG_VERSION
25 become: true
26 become_user: postgres
27
28- name: PostgreSQL 10 server service
29 systemd:
30 name: rh-postgresql10-postgresql
31 state: started
32 enabled: yes
33
34- name: PostgreSQL Zuul DB
35 become: yes
36 become_user: postgres
37 postgresql_db:
38 name: zuul
39 state: present
40
41- name: PostgreSQL Zuul role
42 become: yes
43 become_user: postgres
44 postgresql_user:
45 db: zuul
46 name: zuul
47 priv: "ALL"
48
Jan Kundrát59b00842019-01-22 20:06:15 +010049- name: script for retrieving Zuul tenant configuration from Gerrit
50 copy:
51 dest: /usr/local/bin/zuul-fetch-tenants-from-gerrit.sh
52 src: files/zuul/zuul-fetch-tenants-from-gerrit.sh
53 owner: root
54 group: root
55 mode: 0755
56
Jan Kundrátecaf7a32019-01-11 13:00:14 +010057# TODO: this is always marked as 'changed' for some reason...
Jan Kundrát1c2bb582019-01-10 19:30:43 +010058- name: Install Zuul
59 include_role:
60 name: openstack.zuul
61 vars:
Jan Kundrát9ada9b52019-01-11 12:20:28 +010062 zuul_install_method: pip
Jan Kundrát4cecfdd2020-04-08 13:46:32 +020063 zuul_git_version: '3.18.0'
Jan Kundrát1c2bb582019-01-10 19:30:43 +010064 zuul_pip_executable: /opt/rh/rh-python36/root/bin/pip
65 zuul_pip_extra_args: "--install-option='--install-scripts=/usr/local/bin'"
66 zuul_file_zuul_conf_src: files/zuul/zuul.conf
Jan Kundrát59b00842019-01-22 20:06:15 +010067 zuul_file_main_yaml_manage: false
Jan Kundrát1c2bb582019-01-10 19:30:43 +010068
69- name: Provision Zuul SSH directory
70 file:
71 path: /var/lib/zuul/.ssh
72 state: directory
73 owner: zuul
74 group: zuul
75 mode: 0700
76
77- name: Provision Zuul SSH private key
78 copy:
79 src: ../ansible-cesnet-secrets/zuul/id_rsa
80 dest: /var/lib/zuul/.ssh/id_rsa
81 owner: zuul
82 group: zuul
83 mode: 0600
84
85- name: Gerrit's SSH server pubkey
86 file:
87 path: /var/lib/zuul/.ssh/known_hosts
88 state: touch
Jan Kundrát327e8ae2019-01-28 13:30:59 +010089 modification_time: preserve
90 access_time: preserve
Jan Kundrát1c2bb582019-01-10 19:30:43 +010091 owner: zuul
92 group: zuul
93 mode: 0600
94
95- name: Gerrit's SSH server pubkey content
96 known_hosts:
97 path: /var/lib/zuul/.ssh/known_hosts
98 name: '[gerrit.cesnet.cz]:29418'
99 key: '[gerrit.cesnet.cz]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCbNpJXucXZHmjFeAVQwc87AeUtyYDULfW/AVfkXbJ86JSzoMfV19GSfPf2v+lVVaEJKrHN4I4X2p2vuTiibFHHXRFuquxltQeAY1wMUthL+x67EfcvptPEslwR134HtNX+fJOrrBx2K2Qvj2/BT9JXQm62NbBBIpIrIyBiMUaCnw=='
100
101- name: Gerrit's SSH server pubkey content (IPv6 address)
102 known_hosts:
103 path: /var/lib/zuul/.ssh/known_hosts
104 name: '[2001:718:1:1f:50:56ff:feee:163]:29418'
105 key: '[2001:718:1:1f:50:56ff:feee:163]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCbNpJXucXZHmjFeAVQwc87AeUtyYDULfW/AVfkXbJ86JSzoMfV19GSfPf2v+lVVaEJKrHN4I4X2p2vuTiibFHHXRFuquxltQeAY1wMUthL+x67EfcvptPEslwR134HtNX+fJOrrBx2K2Qvj2/BT9JXQm62NbBBIpIrIyBiMUaCnw=='
106
107- name: fingergw firewall
108 firewalld:
109 zone: public
110 permanent: yes
111 state: enabled
112 port: 79/tcp
113 immediate: yes
Jan Kundrát84eff462019-01-11 11:19:06 +0100114
115- name: Apache modules from SCL
116 package:
117 name: 'httpd24-{{ item }}'
118 state: present
119 with_items:
120 - mod_md
121 - mod_ssl
122 notify:
123 - restart apache
124
125- name: Apache firewall
126 firewalld:
127 zone: public
128 permanent: yes
129 immediate: yes
130 state: enabled
131 service: '{{ item }}'
132 with_items:
133 - http
134 - https
135
136- name: mpm_prefork disabled
137 lineinfile:
138 path: /opt/rh/httpd24/root/etc/httpd/conf.modules.d/00-mpm.conf
139 regexp: '^LoadModule mpm_prefork_module.*'
140 state: absent
141 notify:
142 - restart apache
143
144- name: mpm_event enabled
145 lineinfile:
146 path: /opt/rh/httpd24/root/etc/httpd/conf.modules.d/00-mpm.conf
147 line: 'LoadModule mpm_event_module modules/mod_mpm_event.so'
148 state: present
149 notify:
150 - restart apache
151
152- name: remove default Apache server admin
153 lineinfile:
154 path: /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf
155 regexp: '^ServerAdmin root.*'
156 state: absent
157 notify:
158 - restart apache
159
160- name: Apache server admin jan.kundrat@cesnet.cz
161 lineinfile:
162 path: /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf
163 line: 'ServerAdmin mailto:jan.kundrat@cesnet.cz'
164 state: present
165 notify:
166 - restart apache
167
Jan Kundrátecd797f2020-05-21 11:27:05 +0200168# FIXME: apparently, this still requires a manual fix-up of /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf
169# Remove the cert and key files in there. I'm too lazy to automate that right now. Without that, there's this
170# error message in apache's log:
171# [ssl:warn] [pid 3676:tid 139633325263040] AH10084: Init: (zuul.gerrit.cesnet.cz:443) You configured certificate/key files on this host, but is is covered by a Managed Domain. You need to remove these directives for the Managed Domain to take over.
Jan Kundrát84eff462019-01-11 11:19:06 +0100172- name: Apache LetsEncrypt agreement
173 lineinfile:
174 path: /opt/rh/httpd24/root/etc/httpd/conf.d/00-letsencrypt.conf
175 create: yes
Jan Kundrátecd797f2020-05-21 11:27:05 +0200176 line: '{{ item }}'
Jan Kundrát84eff462019-01-11 11:19:06 +0100177 state: present
Jan Kundrátecd797f2020-05-21 11:27:05 +0200178 with_items:
179 - 'MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf'
180 - 'MDCertificateAuthority https://acme-v02.api.letsencrypt.org/directory'
Jan Kundrát84eff462019-01-11 11:19:06 +0100181 notify:
182 - restart apache
183
184- name: Apache zuul vhost
185 copy:
186 dest: /opt/rh/httpd24/root/etc/httpd/conf.d/20-zuul.gerrit.cesnet.cz.conf
187 src: files/zuul/vhost.conf
188 mode: 0644
189 notify:
190 - restart apache
191
192- name: Apache service
193 systemd:
194 name: httpd24-httpd
195 state: started
196 enabled: yes
Jan Kundrátd920d8c2019-01-22 22:35:19 +0100197
198- name: bubblewrap for Zuul executor
199 package:
200 name: bubblewrap
201 state: present
Jan Kundrátd717ad32019-06-05 23:06:55 +0200202
203- name: JQ for JSON parsing within Zuul jobs
204 package:
205 name: jq
206 state: present