---

- name: add IP addresses to private IP whitelist
  lineinfile:
    dest: /etc/nginx/snippets/ipaddr_whitelist
    line: "allow {{ item }};"
    state: present
  loop: "{{ nginx_ipaddr_whitelist_present }}"
  notify: reload nginx
  tags:
    - nginx
    - ips

- name: remove IP addresses from private IP whitelist
  lineinfile:
    dest: /etc/nginx/snippets/ipaddr_whitelist
    line: "allow {{ item }};"
    state: absent
  loop: "{{ nginx_ipaddr_whitelist_absent }}"
  notify: reload nginx
  tags:
    - nginx
    - ips
