ansible-role-gitea/tasks/main.yaml

63 lines
1.3 KiB
YAML
Raw Normal View History

2022-10-14 15:08:14 +02:00
---
2023-02-06 11:57:58 +01:00
#- name: Install Dependencies
# apt:
# pkg:
# - apparmor
# - docker.io
# - python3-docker
2022-10-14 15:08:14 +02:00
2022-11-08 11:46:39 +01:00
- name: Create git USER
ansible.builtin.user:
name: git
register: git_user
2022-10-14 15:08:14 +02:00
- name: Create Data Directory
file:
2023-02-06 11:57:58 +01:00
path: "/opt/gitea/data"
2022-10-14 15:08:14 +02:00
state: directory
2022-11-08 11:46:39 +01:00
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
2022-10-14 15:08:14 +02:00
mode: '0755'
- name: Create Config Directory
file:
2023-02-06 11:57:58 +01:00
path: "/opt/gitea/config"
2022-10-14 15:08:14 +02:00
state: directory
2022-11-08 11:46:39 +01:00
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
2022-10-14 15:08:14 +02:00
mode: '0755'
- name: Start Docker Daemon
systemd:
name: docker
enabled: yes
state: started
2022-11-11 17:52:53 +01:00
- name: Upload Environment File
ansible.builtin.template:
src: environment.env.j2
2023-02-06 11:57:58 +01:00
dest: "/opt/gitea/environment.env"
2022-11-11 17:52:53 +01:00
owner: "{{ git_user.name }}"
mode: '600'
2022-10-14 15:08:14 +02:00
- name: Create Gitea container
community.docker.docker_container:
name: gitea
2023-02-06 11:57:58 +01:00
image: "gitea:{{ gitea_vars['version'] }}-rootless"
2022-10-14 15:08:14 +02:00
comparisons:
image: strict
volumes: strict
env: strict
restart_policy: unless-stopped
2022-10-25 13:18:57 +02:00
volumes:
2023-02-06 11:57:58 +01:00
- /opt/gitea/data:/var/lib/gitea"
- /opt/gitea/config:/etc/gitea"
2022-10-14 15:08:14 +02:00
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "22:2222"
2022-11-08 11:46:39 +01:00
user: "{{ git_user.uid }}:{{ git_user.group }}"
2023-02-06 11:57:58 +01:00
env_file: "/opt/gitea/environment.env"