Add nft flush and fix indent for script

This commit is contained in:
itdoginfo
2023-04-02 15:10:53 +03:00
parent 7cbf343bc2
commit 0fa929f3e5
2 changed files with 6 additions and 3 deletions

View File

@@ -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

View File

@@ -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
}