---
- name: Enable systemd-firewalld
  become: true
  ansible.builtin.systemd:
    name: firewalld
    state: started
    enabled: true

- name: Configure firewall interface zones
  become: true
  when: item.value.firewall is defined
  ansible.posix.firewalld:
    interface: "{{ item.key }}"
    zone: "{{ item.value.firewall }}"
    state: enabled
    permanent: true
    immediate: true
  loop: "{{ skylab_networking | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
