ansible-nginx/tasks/upstream.yml

31 lines
881 B
YAML

---
- name: TEMPLATE | Deploy PHP upstream to Nginx
template:
src: "etc/nginx/conf.d/php.conf.j2"
dest: "{{ nginx_etc_dir }}/conf.d/php.conf"
when: nginx_php | length > 0
notify: reload nginx
- name: FILE | Delete PHP upstream
file:
path: "{{ nginx_etc_dir }}/conf.d/php.conf"
state: absent
when: nginx_php | length == 0
- name: TEMPLATE | Deploy other upstreams
template:
src: "etc/nginx/conf.d/_upstream.conf.j2"
dest: "{{ nginx_etc_dir }}/conf.d/upstream-{{ item.name }}.conf"
loop: "{{ nginx_upstreams }}"
when: item.state is not defined or item.state == 'present'
notify: reload nginx
- name: FILE | Delete other upstreams
file:
path: "{{ nginx_etc_dir }}/conf.d/upstream-{{ item.name }}.conf"
state: absent
loop: "{{ nginx_upstreams }}"
when: item.state is defined and item.state == 'absent'
notify: reload nginx