homelab/roles/forgejo/tasks/main.yml

49 lines
1.2 KiB
YAML

---
- name: Create forgejo network
become: true
community.docker.docker_network:
name: forgejo
- name: Create redis container
include_role:
name: redis
vars:
preset: cache
container_name: redis-forgejo
docker_networks:
- name: forgejo
- name: Create forgejo volume
become: true
community.docker.docker_volume:
name: forgejo
- name: Copy app.ini
become: true
ansible.builtin.template:
src: app.ini.j2
dest: /var/lib/docker/volumes/forgejo/_data/custom/conf/app.ini
owner: 1000
group: 1000
mode: '0660'
register: appini
- name: Create forgejo container
become: true
community.docker.docker_container:
name: forgejo
image: codeberg.org/forgejo/forgejo:{{ tag }}
env:
USER_UID: "{{ user_uid | string }}"
USER_GID: "{{ user_gid | string }}"
FORGEJO_WORK_DIR: "{{ work_path }}"
FORGEJO_CUSTOM: "{{ work_path }}/custom"
networks:
- name: postgresql
- name: forgejo
- name: minio
- name: haproxy
volumes:
- forgejo:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "{{ ssh_listen_port }}:{{ ssh_listen_port }}"
recreate: "{{ appini.changed }}"
restart_policy: unless-stopped