---
- name: Configure firewall for Fedora
  hosts: localhost
  connection: local
  become: yes
  tasks:
    - name: Ensure firewalld is installed
      ansible.builtin.dnf:
        name: firewalld
        state: present

    - name: Ensure firewalld service is started and enabled
      ansible.builtin.systemd:
        name: firewalld
        state: started
        enabled: yes

    - name: Open firewall for SSH, HTTP, and HTTPS
      ansible.posix.firewalld:
        port: "{{ item }}"
        permanent: yes
        state: enabled
        immediate: yes
      loop:
        - 22/tcp
        - 80/tcp
        - 443/tcp

# ansible-playbook local_firewall.yml
