1
0
Fork 0
mirror of https://github.com/DO1JLR/ansible_role_nginx.git synced 2024-08-16 16:19:48 +02:00

rename service and adjust nginx configuration

This commit is contained in:
L3D 2021-02-04 13:49:56 +01:00
parent 0e3088a642
commit b8325fd754
Signed by: l3d
GPG key ID: CD08445BFF4313D1
4 changed files with 24 additions and 50 deletions

View file

@ -7,7 +7,7 @@
state: restarted
- name: Reload nginx
- name: systemctl reload nginx
systemd:
name: 'nginx.service'
daemon_reload: yes

View file

@ -8,7 +8,7 @@
group: root
mode: 'u=rw,g=r,o=r'
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -23,7 +23,7 @@
group: root
mode: 'u=rw,g=r,o=r'
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -36,7 +36,7 @@
dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_http'
state: link
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -50,7 +50,7 @@
# dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_tls'
# state: link
# notify:
# - Reload nginx
# - systemctl reload nginx
# tags:
# - configuration
# - nginx

View file

@ -1,6 +1,6 @@
---
- name: Copy main nginx configuration file
become: true
copy:
src: 'nginx/nginx.conf'
dest: '/etc/nginx/'
@ -8,87 +8,64 @@
group: root
mode: 'u=rw,g=r,o=r'
notify:
- Reload nginx
tags:
- configuration
- nginx
- systemctl reload nginx
- name: Create 'private' directory
become: true
file:
path: '/etc/nginx/private'
state: directory
owner: root
group: root
mode: 'u=rwx,g=rx,o=rx'
tags:
- configuration
- nginx
- dhparam
- name: Create new dhparam of size '{{ nginx__dhparam_size }}'
become: true
openssl_dhparam:
path: '/etc/nginx/private/dhparam.pem'
size: '{{ nginx__dhparam_size | mandatory }}'
notify:
- Reload nginx
tags:
- configuration
- nginx
- dhparam
- systemctl reload nginx
- name: Create 'sites-available' directory
become: true
file:
path: '/etc/nginx/sites-available'
state: directory
owner: root
group: root
mode: 'u=rwx,g=rx,o=rx'
tags:
- configuration
- nginx
- name: Create 'sites-enabled' directory
become: true
file:
path: '/etc/nginx/sites-enabled'
state: directory
owner: root
group: root
mode: 'u=rwx,g=rx,o=rx'
tags:
- configuration
- nginx
# Todo: Reconsider best practices
- name: Remove default site config from package installation
become: true
file:
path: '{{ item }}'
state: absent
with_items:
- '/etc/nginx/sites-enabled/default'
- '/etc/nginx/sites-available/default'
tags:
- configuration
- nginx
- name: Create 'snippets' directory
become: true
file:
path: '/etc/nginx/snippets'
state: directory
owner: root
group: root
mode: 'u=rwx,g=rx,o=rx'
tags:
- configuration
- nginx
- name: Copy nginx snippet files
become: true
copy:
src: 'files/nginx/snippets/{{ item }}'
dest: '/etc/nginx/snippets/{{ item }}'
@ -97,7 +74,4 @@
mode: 'u=rw,g=r,o=r'
with_items: '{{ snippet_files }}'
notify:
- Reload nginx
tags:
- configuration
- nginx
- systemctl reload nginx

View file

@ -11,7 +11,7 @@
mode: 'u=rw,g=r,o=r'
#when: site.http_plain_template | default(True)
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -27,7 +27,7 @@
mode: 'u=rw,g=r,o=r'
#when: not site.redirect_target | default(True)
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -42,7 +42,7 @@
group: root
mode: 'u=rw,g=r,o=r'
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -57,7 +57,7 @@
group: root
mode: 'u=rw,g=r,o=r'
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -72,7 +72,7 @@
group: root
mode: 'u=rw,g=r,o=r'
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -89,7 +89,7 @@
# with_items: '{{ site.snippets }}'
# when: site.snippets | default([])
# notify:
# - Reload nginx
# - systemctl reload nginx
# tags:
# - configuration
# - nginx
@ -103,7 +103,7 @@
state: link
when: site.http_plain_template | default(True)
notify:
- Reload nginx
- systemctl reload nginx
tags:
- configuration
- nginx
@ -117,7 +117,7 @@
# dest: '/etc/nginx/sites-enabled/{{ site.name }}_tls'
# state: link
# notify:
# - Reload nginx
# - systemctl reload nginx
# tags:
# - configuration
# - nginx