blob: ad73f341fbb5bdc1a6eeb0f33dff4ac23aef7b98 [file] [log] [blame]
SF initial configurator15089072022-10-06 13:33:19 +03001- name: Create project pages directory
2 file:
3 path: "{{ zuul_pagesserver_root }}/{{ zuul.project.name }}"
4 state: directory
5 recurse: yes
6 mode: '0775'
7
8- name: Check fqdn and vhost_name variables
9 fail:
10 msg: "Fail as fqdn and vhost_name are not set"
11 when: (not vhost_name is defined or not vhost_name or
12 not fqdn is defined or not fqdn)
13
14- name: Check for letsencrypt TLS certificate
15 stat:
16 path: "/etc/letsencrypt/pem/{{ vhost_name }}.{{ fqdn }}.pem"
17 register: tls_letsencrypt_cert
18
19- name: Check for static TLS certificate
20 stat:
21 path: "/etc/pki/tls/certs/{{ vhost_name }}.{{ fqdn }}.crt"
22 register: tls_static_cert
23
24- name: Create vhost file
25 template:
26 src: templates/vhost.conf.j2
27 dest: "{{ zuul_pagesvhosts_root }}/pages-{{ zuul.project.name | regex_replace('/', '_') | regex_replace('\\.\\.', '') }}.conf"
28 mode: '0644'
29 register: apache_conf
30
31- name: Upload website to publication server
32 synchronize:
33 src: "{{ zuul.executor.log_root }}/pages/"
34 dest: "{{ zuul_pagesserver_root }}/{{ zuul.project.name }}/"
35 delete: yes
36 recursive: yes
37 no_log: true
38
39# pageuser must be authorized to reload
40# httpd via sudo. However using become and systemd
41# facility fails to match the sudoerd rule.
42- name: reload httpd
43 command: sudo /bin/systemctl reload httpd
44 when: apache_conf is changed