mirror of
https://github.com/itdoginfo/ansible-openwrt-hirkn.git
synced 2025-12-15 19:44:30 +05:00
Add nft flush and fix indent for script
This commit is contained in:
@@ -59,6 +59,7 @@
|
|||||||
src: "{{ ansible_template_dir }}openwrt-hirkn.j2"
|
src: "{{ ansible_template_dir }}openwrt-hirkn.j2"
|
||||||
dest: "/etc/init.d/hirkn"
|
dest: "/etc/init.d/hirkn"
|
||||||
mode: a+x
|
mode: a+x
|
||||||
|
trim_blocks: false
|
||||||
notify:
|
notify:
|
||||||
- Run hirkn script
|
- Run hirkn script
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ script () {
|
|||||||
|
|
||||||
mkdir -p $dir
|
mkdir -p $dir
|
||||||
|
|
||||||
|
{% if list_ip or list_community %}
|
||||||
|
echo "Flush sets"
|
||||||
|
nft flush ruleset
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
echo "Run download lists"
|
echo "Run download lists"
|
||||||
{% if download_utility == "curl" %}
|
{% if download_utility == "curl" %}
|
||||||
|
|
||||||
@@ -88,15 +93,12 @@ script () {
|
|||||||
{% if list_domains %}
|
{% if list_domains %}
|
||||||
{% if ansible_distribution_major_version == "22" and dnsmasqfull_version.stdout >= "2.87" %}
|
{% 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
|
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 %}
|
{% elif ansible_distribution_major_version < "22" and dnsmasqfull_version.stdout %}
|
||||||
sed "s/.*/ipset=\/&\/vpn_domains/" $dir/domains.lst > /tmp/dnsmasq.d/domains
|
sed "s/.*/ipset=\/&\/vpn_domains/" $dir/domains.lst > /tmp/dnsmasq.d/domains
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
echo "Dnsmasq restart"
|
echo "Dnsmasq restart"
|
||||||
/etc/init.d/dnsmasq restart
|
/etc/init.d/dnsmasq restart
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
echo "Firewall restart"
|
echo "Firewall restart"
|
||||||
/etc/init.d/firewall restart
|
/etc/init.d/firewall restart
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user