ansible-nginx/tasks/upstream.yml

30 lines
850 B
YAML
Raw Normal View History

2015-07-15 21:26:27 +07:00
---
- name: TEMPLATE | Deploy PHP upstream to Nginx
2021-09-01 16:58:39 +07:00
ansible.builtin.template:
2017-10-26 16:09:21 +07:00
src: "etc/nginx/conf.d/php.conf.j2"
2017-07-27 17:21:10 +07:00
dest: "{{ nginx_etc_dir }}/conf.d/php.conf"
2021-09-01 16:45:44 +07:00
mode: 0644
owner: root
group: root
2022-11-25 15:52:40 +07:00
notify: Reload nginx
2015-07-15 21:26:27 +07:00
2015-10-08 23:21:40 +07:00
- name: TEMPLATE | Deploy other upstreams
2021-09-01 16:58:39 +07:00
ansible.builtin.template:
2017-10-26 16:09:21 +07:00
src: "etc/nginx/conf.d/_upstream.conf.j2"
2017-07-27 17:21:10 +07:00
dest: "{{ nginx_etc_dir }}/conf.d/upstream-{{ item.name }}.conf"
2021-09-01 16:45:44 +07:00
mode: 0644
owner: root
group: root
loop: "{{ nginx_upstreams }}"
when: item.state is not defined or item.state == 'present'
2022-11-25 15:52:40 +07:00
notify: Reload nginx
- name: FILE | Delete other upstreams
2021-09-01 16:58:39 +07:00
ansible.builtin.file:
2017-07-27 17:21:10 +07:00
path: "{{ nginx_etc_dir }}/conf.d/upstream-{{ item.name }}.conf"
state: absent
2019-02-05 03:25:25 +07:00
loop: "{{ nginx_upstreams }}"
when: item.state is defined and item.state == 'absent'
2022-11-25 15:52:40 +07:00
notify: Reload nginx