ansible-nginx/tasks/main.yml

60 lines
1.5 KiB
YAML
Raw Normal View History

2015-07-15 17:14:39 +07:00
---
2015-07-15 20:18:51 +07:00
- name: APT | Install nginx and dependencies
apt: >
pkg={{ nginx_apt_package }}
state=present
update_cache=yes
cache_valid_time=3600
default_release={{ ansible_distribution_release + '-backports' if nginx_backports else ansible_distribution_release }}
- name: APT | Install python-passlib
apt: pkg=python-passlib state=present
2015-07-15 20:18:51 +07:00
2015-07-30 18:02:21 +07:00
- name: SHELL | Get Nginx version
shell: nginx -v 2>&1 | sed -r 's#.*/##;' | cut -d ' ' -f 1
register: nginx_version
changed_when: false
2015-07-15 20:18:51 +07:00
- name: TEMPLATE | Deploy nginx.conf
2015-11-03 20:44:14 +07:00
template: >
src=etc/nginx/nginx.conf.j2
dest=/etc/nginx/nginx.conf
2015-11-03 20:38:47 +07:00
notify: reload nginx
2015-07-15 20:18:51 +07:00
- name: INCLUDE | Fix legacy
include: legacy.yml
2015-07-15 20:18:51 +07:00
- name: FILE | Create folders
file: dest={{ item }} owner=root mode=0755 state=directory
with_items: "{{ nginx_dirs }}"
2015-07-15 20:18:51 +07:00
#- name: COMMAND | Creates DH file
# command: openssl dhparam -out {{ nginx_dh_path }} {{ nginx_dh_length }}
# args:
# creates: "{{ nginx_dh_path }}"
- name: TEMPLATE | Deploy all helpers
2015-11-03 20:44:14 +07:00
template: >
src={{ item }}
dest={{ nginx_helper_dir }}/{{ item | basename | regex_replace('\.j2$','') }}
with_fileglob: '../templates/etc/nginx/helper/*.j2'
2015-07-15 20:18:51 +07:00
notify: reload nginx
2015-12-09 23:06:59 +07:00
- name: TEMPLATE | Deploy custom http configuration
template: >
src=etc/nginx/conf.d/custom.conf.j2
dest=/etc/nginx/conf.d/custom.conf
notify: reload nginx
2015-07-15 21:26:27 +07:00
- name: INCLUDE | Upstream configuration
include: upstream.yml
2015-07-15 20:18:51 +07:00
when: nginx_php
- name: INCLUDE | htpasswd configuration
include: htpasswd.yml
2015-07-15 20:18:51 +07:00
- name: INCLUDE | Vhosts configuration
include: vhost.yml