ansible-nginx/tasks/upstream.yml

30 lines
850 B
YAML

---
- name: TEMPLATE | Deploy PHP upstream to Nginx
ansible.builtin.template:
src: "etc/nginx/conf.d/php.conf.j2"
dest: "{{ nginx_etc_dir }}/conf.d/php.conf"
mode: 0644
owner: root
group: root
notify: Reload nginx
- name: TEMPLATE | Deploy other upstreams
ansible.builtin.template:
src: "etc/nginx/conf.d/_upstream.conf.j2"
dest: "{{ nginx_etc_dir }}/conf.d/upstream-{{ item.name }}.conf"
mode: 0644
owner: root
group: root
loop: "{{ nginx_upstreams }}"
when: item.state is not defined or item.state == 'present'
notify: Reload nginx
- name: FILE | Delete other upstreams
ansible.builtin.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