From 5a5649ce24a62f962cb2c73e581b0fa1a800ae0c Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Sat, 15 Oct 2022 23:18:11 +0400 Subject: [PATCH] add support OpenWrt 22 --- README.md | 2 ++ playbooks/hirkn.yml | 46 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7a466c6..738907b 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ Playbook для Ansible, автоматизирующий настройку о Тестировалось с - Ansible 2.9.6 - OpenWrt 20.02.3 +- OpenWrt 21.05.0 +- OpenWrt 22.03.0 # Использование diff --git a/playbooks/hirkn.yml b/playbooks/hirkn.yml index efd299d..6b6d319 100644 --- a/playbooks/hirkn.yml +++ b/playbooks/hirkn.yml @@ -41,6 +41,7 @@ opkg: name: ipset state: present + when: ansible_distribution_major_version < "22" - name: install dnscrypt opkg: @@ -206,7 +207,7 @@ src: lan family: ipv4 - - name: add ipset for subnet + - name: add ipset for subnet (<22) uci: command: section config: firewall @@ -217,8 +218,9 @@ match: dst_net storage: hash loadfile: /tmp/lst/subnet.lst + when: ansible_distribution_major_version < "22" - - name: add ipset for ip + - name: add ipset for ip (<22) uci: command: section config: firewall @@ -231,8 +233,9 @@ loadfile: /tmp/lst/ip.lst hashsize: 9900000 maxelem: 9900000 + when: ansible_distribution_major_version < "22" - - name: add ipset for community + - name: add ipset for community (<22) uci: command: section config: firewall @@ -245,6 +248,43 @@ loadfile: /tmp/lst/community.lst hashsize: 9900000 maxelem: 9900000 + when: ansible_distribution_major_version < "22" + + - name: add ipset for subnet (22) + uci: + command: section + config: firewall + type: ipset + find_by: + name: vpn_subnets + value: + match: dst_net + loadfile: /tmp/lst/subnet.lst + when: ansible_distribution_major_version == "22" + + - name: add ipset for ip (22) + uci: + command: section + config: firewall + type: ipset + find_by: + name: vpn_ip + value: + match: dst_net + loadfile: /tmp/lst/ip.lst + when: ansible_distribution_major_version == "22" + + - name: add ipset for community (22) + uci: + command: section + config: firewall + type: ipset + find_by: + name: vpn_community + value: + match: dst_net + loadfile: /tmp/lst/community.lst + when: ansible_distribution_major_version == "22" - name: add mark rule vpn_subnet uci: