This commit is contained in:
parent
4cba7722cd
commit
f13ae508f1
9
project/roles/gitea/handlers/main.yml
Normal file
9
project/roles/gitea/handlers/main.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Reload systemd
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: yes
|
||||
|
||||
- name: Restart gitea
|
||||
ansible.builtin.systemd:
|
||||
name: gitea
|
||||
state: restarted
|
21
project/roles/gitea/tasks/main.yml
Normal file
21
project/roles/gitea/tasks/main.yml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
- name: Create gitea.service
|
||||
ansible.builtin.template:
|
||||
src: gitea.service.j2
|
||||
dest: /etc/systemd/system/gitea.service
|
||||
notify:
|
||||
- reload systemd
|
||||
- restart gitea
|
||||
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Ensure service is started
|
||||
ansible.builtin.systemd:
|
||||
state: started
|
||||
name: gitea
|
||||
|
||||
- name: Ensure service is enabled
|
||||
ansible.builtin.systemd:
|
||||
enabled: yes
|
||||
name: gitea
|
28
project/roles/gitea/templates/gitea.service.j2
Normal file
28
project/roles/gitea/templates/gitea.service.j2
Normal file
@ -0,0 +1,28 @@
|
||||
[Unit]
|
||||
Description=Gitea Container
|
||||
After=docker.service
|
||||
After=dockerdata.mount
|
||||
Requires=docker.service
|
||||
Requires=dockerdata.mount
|
||||
|
||||
[Service]
|
||||
TimeoutStartSec=0
|
||||
Restart=always
|
||||
ExecStartPre=-/usr/bin/docker stop gitea
|
||||
ExecStartPre=-/usr/bin/docker rm gitea
|
||||
ExecStartPre=-/usr/bin/docker pull gitea/gitea:latest
|
||||
ExecStart=/usr/bin/docker run \
|
||||
-p 222:22 \
|
||||
-l "traefik.enable=true" \
|
||||
-l "traefik.http.routers.gitea.rule=Host(`git.t-juice.club`)" \
|
||||
-l "traefik.http.routers.gitea.tls=true" \
|
||||
-l "traefik.http.routers.gitea.tls.certresolver=le" \
|
||||
-l "traefik.http.services.gitea.loadbalancer.server.port=3000" \
|
||||
-v /dockerdata/gitea:/data \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v /etc/timezone:/etc/timezone:ro \
|
||||
--network proxy \
|
||||
--name gitea gitea/gitea:latest
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user