initial commit

This commit is contained in:
pyrschtjag committed 2026-10-02 21:34:01 +04:00
commit 13eace9ce9
219 files changed
+6918

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
[Unit]
Description=Gitea (Git with a cup of tea)
After=network.target
[Service]
LimitNOFILE=524288:524288
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target
+7
View File
@@ -0,0 +1,7 @@
---
- name: restart gitea
ansible.builtin.systemd:
name: gitea
state: restarted
enabled: true
daemon_reload: true
+123
View File
@@ -0,0 +1,123 @@
---
- name: create git group
ansible.builtin.group:
name: git
system: true
state: present
- name: create git user
ansible.builtin.user:
name: git
group: git
system: true
shell: /bin/bash
home: /home/git
create_home: true
comment: "Git Version Control"
state: present
- name: install git
ansible.builtin.apt:
name: git
state: latest
update_cache: true
- name: get latest gitea release info
ansible.builtin.uri:
url: https://api.github.com/repos/go-gitea/gitea/releases/latest
return_content: true
headers:
Accept: "application/vnd.github+json"
register: gitea_latest_release
run_once: true
delegate_to: localhost
vars:
ansible_connection: local
failed_when: false
- name: set gitea version fact
ansible.builtin.set_fact:
gitea_version: "{{ gitea_latest_release.json.tag_name | regex_replace('^v', '') }}"
when:
- gitea_latest_release is succeeded
- gitea_latest_release.json is defined
- gitea_latest_release.json.tag_name is defined
- name: ensure gitea directory exists
ansible.builtin.file:
path: /etc/gitea
state: directory
owner: git
group: root
mode: 0750
- name: download gitea sha256 checksum
ansible.builtin.uri:
url: "https://dl.gitea.com/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64.sha256"
return_content: true
register: gitea_checksum
failed_when: false
- name: download gitea binary
ansible.builtin.get_url:
url: "https://dl.gitea.com/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64"
dest: /usr/local/bin/gitea
mode: '0755'
owner: root
group: root
checksum: "{{ ('sha256:' ~ gitea_checksum.content.split()[0]) if gitea_checksum is succeeded and gitea_checksum.content is defined else omit }}"
notify: restart gitea
- name: deploy gitea config
ansible.builtin.template:
src: "{{ inventory_hostname }}/app.ini.j2"
dest: "/etc/gitea/app.ini"
owner: root
group: git
mode: '0640'
notify: restart gitea
- name: deploy gitea systemd unit
ansible.builtin.copy:
src: gitea.service
dest: /etc/systemd/system/gitea.service
owner: root
group: root
mode: '0644'
notify: restart gitea
- name: check if gitea data directory is a mountpoint
ansible.builtin.command: mountpoint -q /var/lib/gitea
register: vw_mountpoint
failed_when: false
changed_when: false
- name: remove default gitea data directory
ansible.builtin.file:
path: /var/lib/gitea
state: absent
when: vw_mountpoint.rc != 0
- name: ensure gitea data directory exists
ansible.builtin.file:
path: /mnt/gitea/data
state: directory
owner: git
group: git
mode: "0755"
- name: bind mount gitea data directory
ansible.posix.mount:
path: /var/lib/gitea
src: /mnt/gitea/data
fstype: none
opts: bind
state: mounted
notify: restart gitea
- name: set ownership on gitea data directory
ansible.builtin.file:
path: /mnt/gitea/data
owner: git
group: git
recurse: true
+76
View File
@@ -0,0 +1,76 @@
APP_NAME = Gitea: Git with a cup of tea
RUN_USER = git
WORK_PATH = /var/lib/gitea
RUN_MODE = prod
[database]
DB_TYPE = postgres
HOST = {{ hostvars['pgsql'].ip }}:5432
NAME = gitea
USER = gitea_user
PASSWD = `{{ database_password }}`
SCHEMA = public
SSL_MODE = disable
PATH = /var/lib/gitea/data/gitea.db
LOG_SQL = false
[repository]
ROOT = /var/lib/gitea/data/gitea-repositories
[server]
SSH_DOMAIN = gitea.lan
DOMAIN = gitea.oyacoi.ru
HTTP_PORT = 3000
ROOT_URL = http://gitea.oyacoi.ru/
APP_DATA_PATH = /var/lib/gitea/data
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET = {{ lfs_jwt_secret }}
[lfs]
PATH = /var/lib/gitea/data/lfs
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost
[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false
[cron.update_checker]
ENABLED = false
[session]
PROVIDER = file
[log]
MODE = console
LEVEL = info
ROOT_PATH = /var/lib/gitea/log
[repository.pull-request]
DEFAULT_MERGE_STYLE = merge
[repository.signing]
DEFAULT_TRUST_MODEL = committer
[security]
INSTALL_LOCK = true
INTERNAL_TOKEN = {{ internal_token }}
PASSWORD_HASH_ALGO = pbkdf2
[oauth2]
JWT_SECRET = {{ jwt_secret }}