geekoops-nginx/molecule/default/converge.yml
Felix Niederwanger e9045aa96d
Revive the role
This commit revives the role after a long slumber. I've updated the Leap
and Debian versions and fixes some minor issues that occured while
testing.
2022-06-27 13:33:40 +02:00

47 lines
1.3 KiB
YAML

---
- name: Converge
hosts: all
tasks:
- name: "Include geekoops-nginx"
include_role:
name: "geekoops-nginx"
## Setup test enviroment
# Deploy a test site and serve it
- name: Deploy test page
copy:
content: |
<html>Success! The test page is displayed correctly</html>
dest: "{{www_dir}}/index.html"
group: "{{ nginx_user }}"
owner: "{{ nginx_group }}"
mode: 0754
register: deployed
- name: Deploy nginx configuration
copy:
content: |
server {
listen 80 default_server;
listen [::]:80 default_server;
root {{ www_dir }};
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
dest: "{{vhosts_dir}}/default.conf"
owner: root
group: root
mode: 0644
when: deployed.changed and deploy_nginx_config == true
- name: Perform nginx check
shell: nginx -t
when: deployed.changed
# Restart of nginx is required for the new configuration
- name: Restart nginx
systemd:
name: nginx
state: restarted
when: deployed.changed