---
- name: Generate v4 rules
  template: src=generated.v4.j2 dest=/etc/iptables.v4.generated owner=root group=root mode=755
  register: v4_script
  when: firewall_v4_configure

- name: Load v4 rules
  command: /etc/iptables.v4.generated
  register: v4_script_load_result
  failed_when: >-
    v4_script_load_result.rc != 0 or
    'unknown option' in v4_script_load_result.stderr or
    'Table does not exist' in v4_script_load_result.stderr
  when: v4_script|changed

