ansible-personal/roles/nginx/tasks/main.yml
Alan Orth e675b750c4
roles/nginx: Switch to nginx stable branch
Remove old mainline repo and add stable repo to get nginx 1.8.0.

See: http://nginx.org/en/CHANGES-1.8

Signed-off-by: Alan Orth <alan.orth@gmail.com>
2015-04-23 14:52:22 +03:00

55 lines
1.4 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 mainline repo
apt_repository: repo="deb http://nginx.org/packages/mainline/ubuntu/ {{ ansible_distribution_release }} nginx" state=absent
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 state=latest
tags: nginx
- name: Copy nginx configs
copy: src={{ item }} dest=/etc/nginx/{{ item }} mode=0644 owner=root group=root
with_items:
- extra-security.conf
- fastcgi_cache
- 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: Create fastcgi cache dir
file: path=/var/cache/nginx/cached/fastcgi state=directory owner=nginx group=nginx mode=0755
tags: nginx
- include: vhosts.yml
when: nginx_vhosts is defined
tags: nginx
- include: tls_vhosts.yml
when: nginx_tls_vhosts is defined
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: Start & enable nginx service
service: name=nginx state=started enabled=yes
tags: nginx
# vim: set ts=2 sw=2: