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

90 lines
1.6 KiB
YAML

---
- name: Copy main nginx configuration file
copy:
src: 'nginx/nginx.conf'
dest: '/etc/nginx/'
owner: root
group: root
mode: 'u=rw,g=r,o=r'
notify:
- Reload nginx
tags:
- configuration
- nginx
#- name: Create strong dhparams
# openssl_dhparam:
# path: '/etc/nginx/dhparam.pem'
# size: 4096
# notify:
# - Reload nginx
# tags:
# - configuration
# - nginx
# - dhparam
- name: Create 'sites-available' directory
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
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
file:
path: '{{ item }}'
state: absent
with_items:
- '/etc/nginx/sites-enabled/default'
- '/etc/nginx/sites-available/default'
tags:
- configuration
- nginx
- name: Create 'snippets' directory
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
copy:
src: 'files/nginx/snippets/{{ item }}'
dest: '/etc/nginx/snippets/{{ item }}'
owner: root
group: root
mode: 'u=rw,g=r,o=r'
with_items: '{{ snippet_files }}'
notify:
- Reload nginx
tags:
- configuration
- nginx