2017-07-15 13:45:46 +00:00
|
|
|
---
|
|
|
|
- name: Enable nginx service
|
|
|
|
service:
|
|
|
|
name: nginx
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
2017-07-15 15:24:48 +00:00
|
|
|
|
|
|
|
- name: Prepare directories
|
|
|
|
file:
|
|
|
|
path: /var/www/vhosts
|
|
|
|
state: directory
|
|
|
|
owner: nginx
|
|
|
|
group: nginx
|
|
|
|
mode: 0750
|
|
|
|
|
|
|
|
- name: Update nginx.conf
|
|
|
|
template:
|
|
|
|
src: 'etc/nginx/nginx.conf.j2'
|
|
|
|
dest: '/etc/nginx/nginx.conf'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0640
|
|
|
|
notify:
|
|
|
|
- nginx_restart
|
|
|
|
|
|
|
|
- name: Update conf.d files
|
|
|
|
template:
|
|
|
|
src: 'etc/nginx/conf.d/{{ item }}.j2'
|
|
|
|
dest: '/etc/nginx/conf.d/{{ item }}'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0640
|
|
|
|
with_items:
|
2017-07-15 15:26:42 +00:00
|
|
|
- default.conf
|
2017-07-15 15:24:48 +00:00
|
|
|
- header.conf
|
|
|
|
notify:
|
|
|
|
- nginx_restart
|
2017-07-15 15:39:52 +00:00
|
|
|
|
|
|
|
- name: Open ports in iptables
|
|
|
|
iptables_raw:
|
|
|
|
name: allow_nginx_ports
|
|
|
|
state: present
|
|
|
|
rules: '-A INPUT -p tcp -m multiport --dports {{ nginx_open_ports|join(",") }} -j ACCEPT'
|
|
|
|
tags: iptables
|