53 lines
1.5 KiB
YAML
53 lines
1.5 KiB
YAML
---
|
|
- name: Add nginx.org apt signing key
|
|
apt_key: url=http://nginx.org/keys/nginx_signing.key state=present
|
|
tags: nginx
|
|
|
|
- name: Add nginx.org stable repo
|
|
apt_repository: repo="deb http://nginx.org/packages/ubuntu/ {{ ansible_distribution_release }} nginx" state=present
|
|
tags: nginx
|
|
|
|
- name: Install nginx
|
|
apt: pkg=nginx update_cache=yes
|
|
tags: nginx
|
|
|
|
- name: Copy nginx config
|
|
copy: src={{ item }} dest=/etc/nginx/{{ item }} mode=0644 owner=root group=root
|
|
with_items:
|
|
- nginx.conf
|
|
notify:
|
|
- reload nginx
|
|
tags: nginx
|
|
|
|
- name: Remove default nginx vhost
|
|
file: path=/etc/nginx/conf.d/default.conf state=absent
|
|
tags: nginx
|
|
|
|
- name: Configure nginx vhosts
|
|
template: src=vhost.conf.j2 dest={{ nginx_confd_path }}/{{ item.nginx_domain_name }}.conf mode=0644 owner=root group=root
|
|
with_items: nginx_vhosts
|
|
notify:
|
|
- reload nginx
|
|
tags: nginx
|
|
|
|
- name: Create vhost document roots
|
|
file: path={{ nginx_root_prefix }}/{{ item.nginx_domain_name }} state=directory mode=0755 owner=nginx group=nginx
|
|
with_items: nginx_vhosts
|
|
tags: nginx
|
|
|
|
- name: Configure munin vhost
|
|
copy: src=munin.conf dest=/etc/nginx/conf.d/munin.conf mode=0644 owner=root group=root
|
|
notify:
|
|
- reload nginx
|
|
tags: nginx
|
|
|
|
- name: Generate 2048-bit dhparam
|
|
command: openssl dhparam -out dhparam.pem 2048 chdir=/etc/ssl/certs creates=dhparam.pem
|
|
tags: nginx
|
|
|
|
- name: Start & enable nginx service
|
|
service: name=nginx state=started enabled=yes
|
|
tags: nginx
|
|
|
|
# vim: set ts=2 sw=2:
|