---
- name: Update Nginx configuration for Elasticsearch
  ansible.builtin.template:
    src: nginx/upstream-elastic.inc.j2
    dest: /etc/nginx/conf.d/upstream-elastic.inc
    group: root
    mode: "0644"
    owner: root
  notify: Reload Nginx

- name: Update Nginx configuration for IP filtering
  ansible.builtin.template:
    src: nginx/ipfilter-cluster-nodes.inc.j2
    dest: /etc/nginx/conf.d/ipfilter-cluster-nodes.inc
    group: root
    mode: "0644"
    owner: root
  notify: Reload Nginx

- name: Update Nginx configuration for IP filtering
  ansible.builtin.template:
    src: nginx/ipfilter-monitoring.inc.j2
    dest: /etc/nginx/conf.d/ipfilter-monitoring.inc.inc
    group: root
    mode: "0644"
    owner: root
  notify: Reload Nginx
