---
|
|
- include_role:
|
|
name: 'service'
|
|
vars:
|
|
service_name: 'nginx'
|
|
service_packages:
|
|
- 'nginx'
|
|
tags:
|
|
- 'packages'
|
|
|
|
- name: 'disable nginx default configuration'
|
|
file:
|
|
path: '/etc/nginx/sites-enabled/default'
|
|
state: 'absent'
|
|
notify: 'restart nginx'
|
|
|
|
- name: 'create nginx location configuration directory'
|
|
file:
|
|
path: '{{ item }}'
|
|
state: 'directory'
|
|
mode: '0755'
|
|
owner: 'www-data'
|
|
group: 'www-data'
|
|
loop:
|
|
- '/etc/nginx/locations/'
|
|
- '/etc/nginx/locations/{{ server_fqdn }}/'
|
|
|
|
- name: 'upload nginx configuration'
|
|
template:
|
|
src: 'base.j2'
|
|
dest: '/etc/nginx/sites-available/{{ server_fqdn }}.conf'
|
|
notify: 'restart nginx'
|
|
|
|
- name: 'enable nginx configurations'
|
|
file:
|
|
src: '/etc/nginx/sites-available/{{ server_fqdn }}.conf'
|
|
dest: '/etc/nginx/sites-enabled/{{ server_fqdn }}.conf'
|
|
state: 'link'
|
|
notify: 'restart nginx'
|
|
...
|