2014-08-16 23:35:57 +02:00
|
|
|
---
|
|
|
|
- name: Add nginx.org apt signing key
|
2016-08-22 15:19:25 +02:00
|
|
|
apt_key: id=0x573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 url=https://nginx.org/keys/nginx_signing.key state=present
|
2019-03-17 16:29:15 +01:00
|
|
|
register: add_nginx_apt_key
|
2016-08-14 15:33:48 +02:00
|
|
|
tags: nginx, packages
|
2014-08-16 23:35:57 +02:00
|
|
|
|
2015-05-24 23:15:49 +02:00
|
|
|
- name: Add nginx.org repo
|
2015-08-23 12:24:43 +02:00
|
|
|
template: src=nginx_org_sources.list.j2 dest=/etc/apt/sources.list.d/nginx_org_sources.list owner=root group=root mode=0644
|
2019-03-17 16:29:15 +01:00
|
|
|
register: add_nginx_apt_repository
|
2016-08-14 15:33:48 +02:00
|
|
|
tags: nginx, packages
|
2014-08-16 23:35:57 +02:00
|
|
|
|
2019-03-17 16:29:15 +01:00
|
|
|
- name: Update apt cache
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
when:
|
|
|
|
add_nginx_apt_key is changed or
|
|
|
|
add_nginx_apt_repository is changed
|
|
|
|
|
2014-08-16 23:35:57 +02:00
|
|
|
- name: Install nginx
|
2019-03-17 16:29:28 +01:00
|
|
|
apt: pkg=nginx cache_valid_time=3600 state=present
|
2016-08-14 15:33:48 +02:00
|
|
|
tags: nginx, packages
|
2014-08-16 23:35:57 +02:00
|
|
|
|
2017-01-30 14:43:03 +01:00
|
|
|
- name: Copy nginx.conf
|
|
|
|
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf mode=0644 owner=root group=root
|
|
|
|
notify:
|
|
|
|
- reload nginx
|
|
|
|
tags: nginx
|
|
|
|
|
|
|
|
- name: Copy extra nginx configs
|
2014-08-16 23:35:57 +02:00
|
|
|
copy: src={{ item }} dest=/etc/nginx/{{ item }} mode=0644 owner=root group=root
|
2018-04-02 14:52:51 +02:00
|
|
|
loop:
|
2015-01-24 11:05:42 +01:00
|
|
|
- extra-security.conf
|
2015-02-10 21:04:28 +01:00
|
|
|
- fastcgi_cache
|
2014-08-16 23:35:57 +02:00
|
|
|
notify:
|
|
|
|
- reload nginx
|
|
|
|
tags: nginx
|
|
|
|
|
|
|
|
- name: Remove default nginx vhost
|
|
|
|
file: path=/etc/nginx/conf.d/default.conf state=absent
|
|
|
|
tags: nginx
|
|
|
|
|
2015-02-19 16:49:39 +01:00
|
|
|
- name: Create fastcgi cache dir
|
|
|
|
file: path=/var/cache/nginx/cached/fastcgi state=directory owner=nginx group=nginx mode=0755
|
2016-04-15 11:29:35 +02:00
|
|
|
tags: nginx
|
2014-08-16 23:35:57 +02:00
|
|
|
|
2017-10-03 14:02:38 +02:00
|
|
|
- name: Configure nginx virtual hosts
|
2018-04-26 09:45:01 +02:00
|
|
|
include_tasks: vhosts.yml
|
2015-12-09 23:14:47 +01:00
|
|
|
when: nginx_vhosts is defined
|
2014-08-27 19:03:34 +02:00
|
|
|
tags: nginx
|
|
|
|
|
2018-04-26 16:09:09 +02:00
|
|
|
- name: Configure WordPress
|
|
|
|
include_tasks: wordpress.yml
|
|
|
|
when: nginx_vhosts is defined
|
|
|
|
tags: wordpress
|
|
|
|
|
2015-06-04 22:30:06 +02:00
|
|
|
- name: Configure blank nginx vhost
|
|
|
|
template: src=blank-vhost.conf.j2 dest={{ nginx_confd_path }}/blank-vhost.conf mode=0644 owner=root group=root
|
|
|
|
notify:
|
|
|
|
- reload nginx
|
2015-06-05 23:05:09 +02:00
|
|
|
tags: nginx
|
2015-06-04 22:30:06 +02:00
|
|
|
|
2014-08-16 23:35:57 +02:00
|
|
|
- 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
|
|
|
|
|
2016-06-27 18:13:20 +02:00
|
|
|
- name: Start and enable nginx service
|
2017-11-03 11:19:58 +01:00
|
|
|
systemd: name=nginx state=started enabled=yes
|
2014-08-16 23:35:57 +02:00
|
|
|
tags: nginx
|
2014-08-27 19:00:42 +02:00
|
|
|
|
2018-04-26 16:12:22 +02:00
|
|
|
- name: Configure Let's Encrypt
|
|
|
|
include_tasks: letsencrypt.yml
|
2019-11-26 10:19:22 +01:00
|
|
|
when: use_letsencrypt is defined and use_letsencrypt
|
2018-04-26 10:00:47 +02:00
|
|
|
tags: letsencrypt
|
|
|
|
|
2014-08-27 19:00:42 +02:00
|
|
|
# vim: set ts=2 sw=2:
|