2016-11-07 14:00:57 +01:00
|
|
|
---
|
|
|
|
- name: /var/www is present
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.file:
|
2016-11-07 14:00:57 +01:00
|
|
|
path: /var/www
|
|
|
|
state: directory
|
2017-01-05 11:58:01 +01:00
|
|
|
mode: "0755"
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_default_www_files | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: images are copied
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.copy:
|
2016-11-07 14:00:57 +01:00
|
|
|
src: default_www/img
|
|
|
|
dest: /var/www/
|
2017-12-13 15:44:16 +01:00
|
|
|
mode: "0644"
|
2017-01-05 11:58:01 +01:00
|
|
|
directory_mode: "0755"
|
2016-11-07 14:00:57 +01:00
|
|
|
follow: yes
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_default_www_files | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: index is copied
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.template:
|
2016-11-07 14:00:57 +01:00
|
|
|
src: default_www/index.html.j2
|
|
|
|
dest: /var/www/index.html
|
2017-12-13 15:44:16 +01:00
|
|
|
mode: "0644"
|
2017-09-07 02:25:16 +02:00
|
|
|
force: no
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_default_www_files | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
# SSL cert
|
|
|
|
|
2019-12-31 16:56:03 +01:00
|
|
|
- name: Default certificate is present
|
|
|
|
block:
|
|
|
|
- name: Create private key and csr for default site ({{ ansible_fqdn }})
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: openssl req -newkey rsa:2048 -sha256 -nodes -keyout /etc/ssl/private/{{ ansible_fqdn }}.key -out /etc/ssl/{{ ansible_fqdn }}.csr -batch -subj "/CN={{ ansible_fqdn }}"
|
2019-12-31 16:56:03 +01:00
|
|
|
args:
|
|
|
|
creates: "/etc/ssl/private/{{ ansible_fqdn }}.key"
|
|
|
|
|
|
|
|
- name: Adjust rights on private key
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.file:
|
2019-12-31 16:56:03 +01:00
|
|
|
path: /etc/ssl/private/{{ ansible_fqdn }}.key
|
|
|
|
owner: root
|
|
|
|
group: ssl-cert
|
|
|
|
mode: "0640"
|
|
|
|
|
|
|
|
- name: Create certificate for default site
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: openssl x509 -req -days 3650 -sha256 -in /etc/ssl/{{ ansible_fqdn }}.csr -signkey /etc/ssl/private/{{ ansible_fqdn }}.key -out /etc/ssl/certs/{{ ansible_fqdn }}.crt
|
2019-12-31 16:56:03 +01:00
|
|
|
args:
|
|
|
|
creates: "/etc/ssl/certs/{{ ansible_fqdn }}.crt"
|
2021-05-09 23:06:42 +02:00
|
|
|
when: evolinux_default_www_ssl_cert | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2023-03-18 18:35:54 +01:00
|
|
|
- ansible.builtin.meta: flush_handlers
|