mirror of
https://github.com/GeekOops/geekoops-nginx.git
synced 2024-05-20 05:32:22 +00:00
Felix Niederwanger
e9045aa96d
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.
47 lines
1.3 KiB
YAML
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
|