---
|
|
- include: service.yaml
|
|
# static: yes # see static include issue: https://github.com/ansible/ansible/issues/13485
|
|
vars:
|
|
service_name: nginx
|
|
service_packages:
|
|
- nginx
|
|
|
|
- name: disable nginx default configuration
|
|
file: path=/etc/nginx/sites-enabled/default state=absent
|
|
notify: restart nginx
|
|
|
|
- name: install php5-fpm
|
|
apt:
|
|
name: "{{ item }}"
|
|
state: present
|
|
update_cache: yes
|
|
cache_valid_time: 3600
|
|
with_items:
|
|
- php5-fpm
|
|
when: php | bool
|
|
notify:
|
|
- restart nginx
|
|
|
|
- name: upload nginx proxy configuration
|
|
template:
|
|
src: proxy_nginx.j2
|
|
dest: "/etc/nginx/sites-available/{{ config_name }}"
|
|
when: is_proxy | bool
|
|
notify:
|
|
- enable nginx configuration
|
|
- restart nginx
|
|
|
|
- name: add nginx configurations
|
|
template:
|
|
src: "roles/{{ parent_role_path }}/templates/{{ item }}.conf.nginx.j2"
|
|
dest: /etc/nginx/sites-available/{{ item }}.conf
|
|
with_items: "{{ config_names }}"
|
|
|
|
- name: enable nginx configurations
|
|
file:
|
|
src: "/etc/nginx/sites-available/{{ item }}.conf"
|
|
dest: "/etc/nginx/sites-enabled/{{ item }}.conf"
|
|
state: link
|
|
with_items: "{{ config_names }}"
|
|
notify: restart nginx
|