Skip to content

Commit

Permalink
Renaming not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Honigeintopf committed Oct 17, 2024
1 parent d3ce2c6 commit 91aa369
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions partition/roles/mgmt-firewall/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,33 +149,34 @@
- name: Configure new LAN interfaces and DHCP settings
ansible.builtin.raw: |
section_id=$(uci add network interface)
uci set network.$section_id.proto='static'
uci set network.$section_id.ipaddr='{{ item.ipaddr }}'
uci set network.$section_id.netmask='{{ item.netmask }}'
uci set network.$section_id.device='{{ item.device }}'
uci set network.$section_id.delegate='1'
uci set network.$section_id.force_link='1'
uci set network.$section_id.area_type='lan'
uci rename network.$section_id='{{ item.name }}'
uci set network.{{ item.name }}.proto='static'
uci set network.{{ item.name }}.ipaddr='{{ item.ipaddr }}'
uci set network.{{ item.name }}.netmask='{{ item.netmask }}'
uci set network.{{ item.name }}.device='{{ item.device }}'
uci set network.{{ item.name }}.delegate='1'
uci set network.{{ item.name }}.force_link='1'
uci set network.{{ item.name }}.area_type='lan'
uci commit network
/etc/init.d/network restart
uci add_list firewall.2.network="$section_id"
uci add_list firewall.2.network='{{ item.name }}'
uci commit firewall
/etc/init.d/firewall restart
# Configuring DHCP for the new interface, no need to limit
uci set dhcp.$section_id.interface="$section_id"
uci set dhcp.$section_id=dhcp
uci set dhcp.$section_id.start='2'
uci set dhcp.$section_id.limit='2'
uci set dhcp.$section_id.leasetime='12h'
uci set dhcp.$section_id.netmask='255.255.255.252' # This is hardcoded right now, because limit has to be changed according to the netmask
uci set dhcp.$section_id.ra='server'
uci set dhcp.$section_id.dhcpv6='server'
uci set dhcp.$section_id.ignore_ipv6='1'
uci set dhcp.$section_id.force='0'
uci set dhcp.{{ item.name }}.interface='{{ item.name }}'
uci set dhcp.{{ item.name }}=dhcp
uci set dhcp.{{ item.name }}.leasetime='12h'
uci set dhcp.{{ item.name }}.start='2'
uci set dhcp.{{ item.name }}.limit='2'
uci set dhcp.{{ item.name }}.netmask='255.255.255.252'
uci set dhcp.{{ item.name }}.ra='server'
uci set dhcp.{{ item.name }}.dhcpv6='server'
uci set dhcp.{{ item.name }}.ignore_ipv6='1'
uci set dhcp.{{ item.name }}.force='0'
{% for option in item.dhcp_options %}
uci add_list dhcp.$section_id.dhcp_option_force="{{ option.option }},{{ option.value }}"
uci add_list dhcp.{{ item.name }}.dhcp_option_force="{{ option.option }},{{ option.value }}"
{% endfor %}
uci commit dhcp
/etc/init.d/dnsmasq restart
Expand Down

0 comments on commit 91aa369

Please sign in to comment.