observability.svc.plus/roles/node_remove/tasks/nginx.yml
2026-02-01 20:53:55 +08:00

29 lines
1.1 KiB
YAML

---
#--------------------------------------------------------------#
# Remove HAProxy from Nginx [register,nginx]
#--------------------------------------------------------------#
- name: remove haproxy instance from nginx
become: true
ignore_errors: true
block:
# /etc/nginx/conf.d/haproxy/upstream-{{ nodename }}.conf
- name: remove haproxy upstream from nginx
delegate_to: '{{ item }}'
loop: '{{ groups["infra"]|default([]) }}'
file: state=absent path=/etc/nginx/conf.d/haproxy/upstream-{{ nodename }}.conf
# /etc/nginx/conf.d/haproxy/location-{{ nodename }}.conf
- name: remove haproxy url location from nginx
delegate_to: '{{ item }}'
loop: '{{ groups["infra"]|default([]) }}'
file: state=absent path=/etc/nginx/conf.d/haproxy/location-{{ nodename }}.conf
# reload meta node nginx (maybe not appropriate here)
- name: reload nginx to remove haproxy upstream
run_once: true
delegate_to: '{{ item }}'
loop: '{{ groups["infra"]|default([]) }}'
systemd: name=nginx state=reloaded enabled=yes daemon_reload=yes
...