Initialize sf-jobs repository
diff --git a/roles/upload-pages/tasks/main.yaml b/roles/upload-pages/tasks/main.yaml
new file mode 100644
index 0000000..ad73f34
--- /dev/null
+++ b/roles/upload-pages/tasks/main.yaml
@@ -0,0 +1,44 @@
+- name: Create project pages directory
+ file:
+ path: "{{ zuul_pagesserver_root }}/{{ zuul.project.name }}"
+ state: directory
+ recurse: yes
+ mode: '0775'
+
+- name: Check fqdn and vhost_name variables
+ fail:
+ msg: "Fail as fqdn and vhost_name are not set"
+ when: (not vhost_name is defined or not vhost_name or
+ not fqdn is defined or not fqdn)
+
+- name: Check for letsencrypt TLS certificate
+ stat:
+ path: "/etc/letsencrypt/pem/{{ vhost_name }}.{{ fqdn }}.pem"
+ register: tls_letsencrypt_cert
+
+- name: Check for static TLS certificate
+ stat:
+ path: "/etc/pki/tls/certs/{{ vhost_name }}.{{ fqdn }}.crt"
+ register: tls_static_cert
+
+- name: Create vhost file
+ template:
+ src: templates/vhost.conf.j2
+ dest: "{{ zuul_pagesvhosts_root }}/pages-{{ zuul.project.name | regex_replace('/', '_') | regex_replace('\\.\\.', '') }}.conf"
+ mode: '0644'
+ register: apache_conf
+
+- name: Upload website to publication server
+ synchronize:
+ src: "{{ zuul.executor.log_root }}/pages/"
+ dest: "{{ zuul_pagesserver_root }}/{{ zuul.project.name }}/"
+ delete: yes
+ recursive: yes
+ no_log: true
+
+# pageuser must be authorized to reload
+# httpd via sudo. However using become and systemd
+# facility fails to match the sudoerd rule.
+- name: reload httpd
+ command: sudo /bin/systemctl reload httpd
+ when: apache_conf is changed