diff --git a/.github/workflows/test-configuration.yaml b/.github/workflows/test-configuration.yaml index f2c7bc8..58fac27 100644 --- a/.github/workflows/test-configuration.yaml +++ b/.github/workflows/test-configuration.yaml @@ -12,7 +12,7 @@ jobs: persist-credentials: false fetch-depth: 0 - name: Run Ansible Playbook - uses: arillso/action.playbook@master + uses: ansible-lockdown/action.playbook@main with: playbook: test_config_local.yaml inventory: inventory-sample.yaml diff --git a/ansible-requirements.yaml b/ansible-requirements.yaml index 093cc3a..2034706 100644 --- a/ansible-requirements.yaml +++ b/ansible-requirements.yaml @@ -2,3 +2,4 @@ roles: - name: gekmihesg.openwrt collections: - name: ansible.utils + - name: community.general diff --git a/bin/upgrade-all-packages b/bin/upgrade-all-packages index 9526f0e..d90f181 100644 --- a/bin/upgrade-all-packages +++ b/bin/upgrade-all-packages @@ -13,8 +13,9 @@ if [ $LATEST_RELEASE != $DISTRIB_RELEASE ]; then fi echo "" -echo "Updating package list..." +echo -n "Updating package list..." opkg update > /dev/null +echo "" if [ `opkg list-upgradable | cut -d " " -f1 | wc -l` -gt 0 ]; then echo "Available updates:" diff --git a/config/network b/config/network index 0aa76b7..6a351e3 100644 --- a/config/network +++ b/config/network @@ -8,8 +8,12 @@ config interface 'loopback' config globals 'globals' option ula_prefix '{{ ula_prefix }}' -config device 'wan_eth0_2_dev' +config device +{% if vlans is defined %} + option name 'eth0.{{ vlans | community.general.json_query('[?wan].vid') | first }}' +{% else %} option name 'eth0.2' +{% endif %} option macaddr '{{ mac }}' config switch @@ -32,11 +36,19 @@ config interface 'lan' option ip6ifaceid '::{{ id }}' config interface 'wan' - option device 'eth0.300' +{% if vlans is defined %} + option device 'eth0.{{ vlans | community.general.json_query('[?wan].vid') | first }}' +{% else %} + option device 'eth0.2' +{% endif %} option proto 'dhcp' config interface 'wan6' - option device 'eth0.300' +{% if vlans is defined %} + option device 'eth0.{{ vlans | community.general.json_query('[?wan].vid') | first }}' +{% else %} + option device 'eth0.2' +{% endif %} option proto 'dhcpv6' option reqaddress 'try' option reqprefix 'auto' @@ -47,26 +59,24 @@ config switch_vlan option ports '0t 2 3 4 5' option vid '1' +{% if vlans is defined %} +{% for vlan in vlans %} config switch_vlan option device 'switch0' - option vlan '2' - option ports '0t 1t' - option vid '100' - option description 'Management' - -config switch_vlan - option device 'switch0' - option vlan '3' - option ports '0t 1t' - option vid '300' - option description 'Internet' + option vlan '{{ loop.index+1 }}' + option ports '{{ vlan.ports }}' + option vid '{{ vlan.vid }}' +{% if vlan.name is defined %} + option description '{{ vlan.name }}' +{% endif %} +{% endfor %} +{% else %} config switch_vlan - option device 'switch0' - option vlan '4' - option ports '0t 1t' - option vid '640' - option description 'Television' + option devide 'switch0' + option vlan '2' + option ports '0t 2 3 4 5' +{% endif %} {% if ipv6_6to4 is defined %} config interface 'wan6to4' diff --git a/config/system b/config/system index db02915..19ddabf 100644 --- a/config/system +++ b/config/system @@ -22,7 +22,7 @@ config led option default '0' {% if inventory_hostname in groups['routers'] %} option trigger 'netdev' - option dev 'eth0.2' + option dev 'eth0' list mode 'tx' list mode 'rx' {% else %} diff --git a/inventory-sample.yaml b/inventory-sample.yaml index 17279c9..e0bc904 100644 --- a/inventory-sample.yaml +++ b/inventory-sample.yaml @@ -97,14 +97,13 @@ openwrt: # installed is always common_packages_installed + packages_installed common_packages: install: - - wpad-wolfssl - - luci-ssl + - wpad-mbedtls - nano - fping # Packages that will be removed on all devices. Use `packages_removed` # to set packages on a group level that should be removed. remove: - - wpad-basic-wolfssl + - wpad-basic-mbedtls # Network address, this would allow address from 10.0.0.1 - 10.0.0.255 network: 10.0.0.0/24 # Local domain name @@ -206,3 +205,15 @@ openwrt: # retrieved. upnp: configure_with_external_ip: false + # Optional configuration for VLANs + # vlans: + # - name: Management + # vid: 100 + # ports: 0t 1t + # - name: Internet + # vid: 300 + # ports: 0t 1t + # # for the main VLAN that connect to the WAN, set wan to true + # wan: true + # - name: Television + # vid: 640 diff --git a/readme.md b/readme.md index 3476e93..e39ad9b 100644 --- a/readme.md +++ b/readme.md @@ -17,12 +17,12 @@ Besides a description of the setup, this repository also includes an Ansible playbook and inventory to centrally apply configuration changes to all devices and/or update the firmware version on all devices. -This configuration and the Ansible playbook have been tested with OpenWrt 22.03, 21.02, and 19.07. +This configuration and the Ansible playbook have been tested with OpenWrt 23.05, 22.03, 21.02, and 19.07. It has at least been tested on TP-Link Archer C7-v5 and TP-Link WDR4300 v1, but in theory any router supported by OpenWrt should work. -The main branch is based on OpenWrt 22.03. The branches _openwrt-22.02_ and _openwrt-19.07_ contains -the previous configurations for 22.02 and 19.07 respectively. A lot of improvements from later version +The main branch is based on OpenWrt 23.05. The branches _openwrt-22.03_, _openwrt-21.02_ and _openwrt-19.07_ contains +the previous configurations for 21.02 and 19.07 respectively. A lot of improvements from later version could be backported to older version, if desired. ## Table of content @@ -57,8 +57,8 @@ things can be configured as desired. ### Packages -* Remove the package _wpad-basic-wolfssl_. -* Install the packages _wpad-wolfssl_ and _luci-app-dawn_. +* Remove the package _wpad-basic-mbedtls. +* Install the packages _wpad-mbedtls and _luci-app-dawn_. ### System @@ -137,8 +137,8 @@ Each access point is configured in the same way. ### Packages -* Remove the package _wpad-basic-wolfssl_. -* Install the package _wpad-wolfssl_ and _dawn_. +* Remove the package _wpad-basic-mbedtls_. +* Install the package _wpad-mbedtls_ and _dawn_. ### System