41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
---
|
|
- name: install nginx webserver
|
|
apt: pkg=nginx-full state=present
|
|
sudo: yes
|
|
|
|
# TODO Look at using templated configuration
|
|
- name: configure nginx
|
|
copy: src=nginx/{{ app_nginx_conf }} dest=/etc/nginx/sites-available
|
|
|
|
- name: enable the copied over nginx configuration
|
|
file: state=link
|
|
src=/etc/nginx/sites-available/{{ app_nginx_conf }}
|
|
path=/etc/nginx/sites-enabled/{{ app_nginx_conf }}
|
|
sudo: yes
|
|
|
|
- name: disable the default page configuration
|
|
file: state=absent path=/etc/nginx/sites-enabled/default
|
|
sudo: yes
|
|
|
|
- name: restart nginx
|
|
service: name=nginx state=restarted
|
|
sudo: yes
|
|
|
|
- name: set permissions on nginx config + log directories
|
|
file: path={{ item }} state=directory
|
|
group={{ web_server_group }} mode=0755
|
|
with_items:
|
|
- /var/log/nginx
|
|
- /etc/nginx
|
|
- /etc/nginx/sites-available
|
|
- /etc/nginx/sites-enabled
|
|
sudo: yes
|
|
|
|
- name: set permissions on nginx logs
|
|
file: path=/var/log/nginx/{{ item }} state=file
|
|
owner={{ web_server_group }} group={{ web_server_group }} mode=0644
|
|
with_items:
|
|
- access.log
|
|
- error.log
|
|
sudo: yes
|