---
- name: Create html directory
  ansible.builtin.file:
    path: '{{ html_dir }}'
    state: directory
    mode: '0755'

- name: Populate index.html file
  ansible.builtin.template:
    src: index.j2
    dest: "{{ html_dir }}/index.html"

- name: Create apache container
  containers.podman.podman_container:
    name: "{{ app }}-httpd"
    state: started
    network: "{{ podman_network }}"
    image: docker.io/httpd:latest
    ports:
      - "8080:80"
    volume:
      - "/home/seandersont/{{ html_dir }}:/usr/local/apache2/htdocs/"
    security_opt: "label=disable"

- name: Set Firewall Rules
  ansible.posix.firewalld:
    port: 8080/tcp
    state: enabled
    zone: public
  become: true
