---

- name: Save The Current ipv4 State
  community.general.iptables_state:
    ip_version: "ipv4"
    state: saved
    path: "/etc/iptables/iptables.rules"
  when:
    - '"ipv4" in iptables_ip_versions'
    - '"iptables" in iptables_services'
  notify: Restart Iptables Services

- name: Save The Current ipv6 State
  community.general.iptables_state:
    ip_version: "ipv6"
    state: saved
    path: "/etc/iptables/ip6tables.rules"
  when:
    - '"ipv6" in iptables_ip_versions'
    - '"ip6tables" in iptables_services'
  notify: Restart Iptables Services
