---
# vars file for firewall
_firewall_ansible_python_interpreter:
  default: /usr/bin/python
  Fedora: /usr/bin/python3

firewall_ansible_python_interpreter: "{{ _firewall_ansible_python_interpreter[ansible_distribution] |default(_firewall_ansible_python_interpreter['default']) }}"

_firewall_packages:
  conflicting:
    default:
      - firewalld
    Alpine:
      - firewalld
      - ufw
    CentOS-6:
      - firewalld
      - ufw
    CentOS-7:
      - ufw
    Fedora:
      - ufw
    openSUSE Leap:
      - ufw
    openSUSE Tumbleweed:
      - ufw
  required:
    default:
      - ufw
    Alpine:
      - iptables
    CentOS-6:
      - iptables
    CentOS-7:
      - firewalld
      - iptables
      - iptables-services
    Fedora:
      - firewalld
      - python3-firewall
    openSUSE Leap:
      - firewalld
    openSUSE Tumbleweed:
      - firewalld

firewall_packages_conflicting: "{{ _firewall_packages['conflicting'][ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_firewall_packages['conflicting'][ansible_distribution] | default(_firewall_packages['conflicting']['default'])) }}"

firewall_packages_required: "{{ _firewall_packages['required'][ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_firewall_packages['required'][ansible_distribution] | default(_firewall_packages['required']['default'])) }}"

_firewall_service:
  default: ufw
  Alpine: iptables
  CentOS-6: iptables
  CentOS-7: firewalld
  Fedora: firewalld
  openSUSE Leap: firewalld
  openSUSE Tumbleweed: firewalld

firewall_service: "{{ _firewall_service[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default (_firewall_service[ansible_distribution] | default (_firewall_service['default'])) }}"

_firewall_iptables_rulefile:
  Alpine: /etc/iptables/rules-save
  CentOS-6: /etc/sysconfig/iptables

firewall_iptables_rulefile: "{{ _firewall_iptables_rulefile[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_firewall_iptables_rulefile[ansible_distribution] | default(_firewall_iptables_rulefile['default'])) }}"
