ansible-role-gitea/tasks/main.yaml

63 lines
1.3 KiB
YAML

---
#- name: Install Dependencies
# apt:
# pkg:
# - apparmor
# - docker.io
# - python3-docker
- name: Create git USER
ansible.builtin.user:
name: git
register: git_user
- name: Create Data Directory
file:
path: "/opt/gitea/data"
state: directory
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
mode: '0755'
- name: Create Config Directory
file:
path: "/opt/gitea/config"
state: directory
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
mode: '0755'
- name: Start Docker Daemon
systemd:
name: docker
enabled: yes
state: started
- name: Upload Environment File
ansible.builtin.template:
src: environment.env.j2
dest: "/opt/gitea/environment.env"
owner: "{{ git_user.name }}"
mode: '600'
- name: Create Gitea container
community.docker.docker_container:
name: gitea
image: "gitea:{{ gitea_vars['version'] }}-rootless"
comparisons:
image: strict
volumes: strict
env: strict
restart_policy: unless-stopped
volumes:
- /opt/gitea/data:/var/lib/gitea"
- /opt/gitea/config:/etc/gitea"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "22:2222"
user: "{{ git_user.uid }}:{{ git_user.group }}"
env_file: "/opt/gitea/environment.env"