From 0fa929f3e54b196f28ff1171e95a9127da1d034b Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Sun, 2 Apr 2023 15:10:53 +0300 Subject: [PATCH] Add nft flush and fix indent for script --- playbooks/hirkn.yml | 1 + templates/openwrt-hirkn.j2 | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/playbooks/hirkn.yml b/playbooks/hirkn.yml index c1f49dc..a71adbc 100644 --- a/playbooks/hirkn.yml +++ b/playbooks/hirkn.yml @@ -59,6 +59,7 @@ src: "{{ ansible_template_dir }}openwrt-hirkn.j2" dest: "/etc/init.d/hirkn" mode: a+x + trim_blocks: false notify: - Run hirkn script diff --git a/templates/openwrt-hirkn.j2 b/templates/openwrt-hirkn.j2 index 6915072..3c3b73a 100644 --- a/templates/openwrt-hirkn.j2 +++ b/templates/openwrt-hirkn.j2 @@ -45,6 +45,11 @@ script () { mkdir -p $dir + {% if list_ip or list_community %} + echo "Flush sets" + nft flush ruleset + {% endif %} + echo "Run download lists" {% if download_utility == "curl" %} @@ -88,15 +93,12 @@ script () { {% if list_domains %} {% if ansible_distribution_major_version == "22" and dnsmasqfull_version.stdout >= "2.87" %} sed "s/.*/nftset=\/&\/4#inet#fw4#vpn_domains/" $dir/domains.lst > /tmp/dnsmasq.d/domains - {% elif ansible_distribution_major_version < "22" and dnsmasqfull_version.stdout %} sed "s/.*/ipset=\/&\/vpn_domains/" $dir/domains.lst > /tmp/dnsmasq.d/domains {% endif %} - echo "Dnsmasq restart" /etc/init.d/dnsmasq restart {% endif %} - echo "Firewall restart" /etc/init.d/firewall restart }