openwisp / ansible-openwisp2

Ansible role that installs and upgrades OpenWISP.
https://openwisp.io/docs/dev/ansible/
BSD 3-Clause "New" or "Revised" License
474 stars 136 forks source link

Allow multiple openwisp2_admin_allowed_network #481

Open cbeaujoin-stellar opened 1 month ago

cbeaujoin-stellar commented 1 month ago

Allow multiple openwisp2_admin_allowed_network in nginx site-conf.j2 template

https://github.com/openwisp/ansible-openwisp2/blob/dcdcd21aa59c38a401cd7bcdb1adfbf24de1ffbe/templates/nginx/site-conf.j2#L68

    {% if openwisp2_admin_allowed_network %}
    location /admin/ {
        try_files {{ openwisp2_path }}/public_html/maintenance.html $uri @uwsgi;
        {% for network in openwisp2_admin_allowed_network %}
        allow {{ network }};
        {% endfor %}
        deny all;
    }
    {% endif %}

https://github.com/openwisp/ansible-openwisp2/blob/dcdcd21aa59c38a401cd7bcdb1adfbf24de1ffbe/defaults/main.yml#L68

openwisp2_admin_allowed_network: []

IE:

openwisp2_admin_allowed_network:
  - "192.168.1.0/24"
  - "10.0.0.1"