--- - name: Create Gitea directory ansible.builtin.file: path: "{{ gitea_dir }}" state: directory owner: root group: root mode: "0755" tags: [gitea] - name: Render Gitea environment ansible.builtin.template: src: env.j2 dest: "{{ gitea_dir }}/.env" owner: root group: root mode: "0600" no_log: true tags: [gitea, config] - name: Ensure Gitea proxy network exists community.docker.docker_network: name: "{{ gitea_traefik_network }}" state: present when: gitea_routing_mode == "traefik" tags: [gitea, docker] - name: Render Gitea Compose file ansible.builtin.template: src: compose.yaml.j2 dest: "{{ gitea_dir }}/compose.yaml" owner: root group: root mode: "0644" notify: restart gitea tags: [gitea, compose] - name: Allow Gitea ports community.general.ufw: rule: allow port: "{{ item }}" proto: tcp loop: "{{ gitea_tcp_ports }}" when: gitea_routing_mode == "host" tags: [gitea, firewall] - name: Allow Gitea SSH port when published behind Traefik community.general.ufw: rule: allow port: "{{ gitea_ssh_port }}" proto: tcp when: - gitea_routing_mode == "traefik" - gitea_publish_ssh | bool tags: [gitea, firewall] - name: Start Gitea community.docker.docker_compose_v2: project_src: "{{ gitea_dir }}" state: present tags: [gitea, compose]