Fix "nftables" ansible role

Fixed "iptables" restore tasks:
- Using the "ipvX_rules_file.stat.exists" flag
- Retrieving the correct path name from the stored variable.

Change-Id: I61a07b9b0c0fd3c0906ed8efe0b09bf0988ccdfb
Closes-Bug: #1926313
This commit is contained in:
Rodolfo Alonso Hernandez 2021-04-27 15:54:42 +00:00
parent 309639ca89
commit 97e34498f7

View File

@ -33,11 +33,13 @@
- name: Restore saved IPv4 iptables rules, stored by iptables-persistent - name: Restore saved IPv4 iptables rules, stored by iptables-persistent
shell: shell:
cmd: | cmd: |
iptables-restore '{{ ipv4_rules_file }}' iptables-restore '{{ ipv4_rules_file.stat.path }}'
become: yes become: yes
when: ipv4_rules_file.stat.exists
- name: Restore saved IPv6 iptables rules, stored by iptables-persistent - name: Restore saved IPv6 iptables rules, stored by iptables-persistent
shell: shell:
cmd: | cmd: |
ip6tables-restore '{{ ipv6_rules_file }}' ip6tables-restore '{{ ipv6_rules_file.stat.path }}'
become: yes become: yes
when: ipv6_rules_file.stat.exists