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:
parent
0e3088a642
commit
b8325fd754
4 changed files with 24 additions and 50 deletions
|
@ -7,7 +7,7 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
|
||||||
- name: Reload nginx
|
- name: systemctl reload nginx
|
||||||
systemd:
|
systemd:
|
||||||
name: 'nginx.service'
|
name: 'nginx.service'
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_http'
|
dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_http'
|
||||||
state: link
|
state: link
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
# dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_tls'
|
# dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_tls'
|
||||||
# state: link
|
# state: link
|
||||||
# notify:
|
# notify:
|
||||||
# - Reload nginx
|
# - systemctl reload nginx
|
||||||
# tags:
|
# tags:
|
||||||
# - configuration
|
# - configuration
|
||||||
# - nginx
|
# - nginx
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Copy main nginx configuration file
|
- name: Copy main nginx configuration file
|
||||||
|
become: true
|
||||||
copy:
|
copy:
|
||||||
src: 'nginx/nginx.conf'
|
src: 'nginx/nginx.conf'
|
||||||
dest: '/etc/nginx/'
|
dest: '/etc/nginx/'
|
||||||
|
@ -8,87 +8,64 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- nginx
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create 'private' directory
|
- name: Create 'private' directory
|
||||||
|
become: true
|
||||||
file:
|
file:
|
||||||
path: '/etc/nginx/private'
|
path: '/etc/nginx/private'
|
||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rwx,g=rx,o=rx'
|
mode: 'u=rwx,g=rx,o=rx'
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- nginx
|
|
||||||
- dhparam
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create new dhparam of size '{{ nginx__dhparam_size }}'
|
- name: Create new dhparam of size '{{ nginx__dhparam_size }}'
|
||||||
|
become: true
|
||||||
openssl_dhparam:
|
openssl_dhparam:
|
||||||
path: '/etc/nginx/private/dhparam.pem'
|
path: '/etc/nginx/private/dhparam.pem'
|
||||||
size: '{{ nginx__dhparam_size | mandatory }}'
|
size: '{{ nginx__dhparam_size | mandatory }}'
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- nginx
|
|
||||||
- dhparam
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create 'sites-available' directory
|
- name: Create 'sites-available' directory
|
||||||
|
become: true
|
||||||
file:
|
file:
|
||||||
path: '/etc/nginx/sites-available'
|
path: '/etc/nginx/sites-available'
|
||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rwx,g=rx,o=rx'
|
mode: 'u=rwx,g=rx,o=rx'
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- nginx
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create 'sites-enabled' directory
|
- name: Create 'sites-enabled' directory
|
||||||
|
become: true
|
||||||
file:
|
file:
|
||||||
path: '/etc/nginx/sites-enabled'
|
path: '/etc/nginx/sites-enabled'
|
||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rwx,g=rx,o=rx'
|
mode: 'u=rwx,g=rx,o=rx'
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- nginx
|
|
||||||
|
|
||||||
|
|
||||||
# Todo: Reconsider best practices
|
# Todo: Reconsider best practices
|
||||||
- name: Remove default site config from package installation
|
- name: Remove default site config from package installation
|
||||||
|
become: true
|
||||||
file:
|
file:
|
||||||
path: '{{ item }}'
|
path: '{{ item }}'
|
||||||
state: absent
|
state: absent
|
||||||
with_items:
|
with_items:
|
||||||
- '/etc/nginx/sites-enabled/default'
|
- '/etc/nginx/sites-enabled/default'
|
||||||
- '/etc/nginx/sites-available/default'
|
- '/etc/nginx/sites-available/default'
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- nginx
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create 'snippets' directory
|
- name: Create 'snippets' directory
|
||||||
|
become: true
|
||||||
file:
|
file:
|
||||||
path: '/etc/nginx/snippets'
|
path: '/etc/nginx/snippets'
|
||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rwx,g=rx,o=rx'
|
mode: 'u=rwx,g=rx,o=rx'
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- nginx
|
|
||||||
|
|
||||||
|
|
||||||
- name: Copy nginx snippet files
|
- name: Copy nginx snippet files
|
||||||
|
become: true
|
||||||
copy:
|
copy:
|
||||||
src: 'files/nginx/snippets/{{ item }}'
|
src: 'files/nginx/snippets/{{ item }}'
|
||||||
dest: '/etc/nginx/snippets/{{ item }}'
|
dest: '/etc/nginx/snippets/{{ item }}'
|
||||||
|
@ -97,7 +74,4 @@
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
with_items: '{{ snippet_files }}'
|
with_items: '{{ snippet_files }}'
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- nginx
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
#when: site.http_plain_template | default(True)
|
#when: site.http_plain_template | default(True)
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
#when: not site.redirect_target | default(True)
|
#when: not site.redirect_target | default(True)
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 'u=rw,g=r,o=r'
|
mode: 'u=rw,g=r,o=r'
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
# with_items: '{{ site.snippets }}'
|
# with_items: '{{ site.snippets }}'
|
||||||
# when: site.snippets | default([])
|
# when: site.snippets | default([])
|
||||||
# notify:
|
# notify:
|
||||||
# - Reload nginx
|
# - systemctl reload nginx
|
||||||
# tags:
|
# tags:
|
||||||
# - configuration
|
# - configuration
|
||||||
# - nginx
|
# - nginx
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
state: link
|
state: link
|
||||||
when: site.http_plain_template | default(True)
|
when: site.http_plain_template | default(True)
|
||||||
notify:
|
notify:
|
||||||
- Reload nginx
|
- systemctl reload nginx
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
- nginx
|
- nginx
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
# dest: '/etc/nginx/sites-enabled/{{ site.name }}_tls'
|
# dest: '/etc/nginx/sites-enabled/{{ site.name }}_tls'
|
||||||
# state: link
|
# state: link
|
||||||
# notify:
|
# notify:
|
||||||
# - Reload nginx
|
# - systemctl reload nginx
|
||||||
# tags:
|
# tags:
|
||||||
# - configuration
|
# - configuration
|
||||||
# - nginx
|
# - nginx
|
||||||
|
|
Loading…
Reference in a new issue