Git initial commit
This commit is contained in:
commit
1d914f4afb
9
LICENSE
Executable file
9
LICENSE
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) <year> <copyright holders>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
42
defaults/main.yml
Executable file
42
defaults/main.yml
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
cloud_apps: /opt
|
||||||
|
cloud_storage: /opt/storage
|
||||||
|
cloud_stage: prod
|
||||||
|
cloud_update: false
|
||||||
|
|
||||||
|
gitea_data_location: "{{ cloud_storage }}/gitea-data"
|
||||||
|
|
||||||
|
gitea_db:
|
||||||
|
type: pgsql
|
||||||
|
name: gitea_db
|
||||||
|
user: gitea_dbu
|
||||||
|
pass: gitea_dbpw
|
||||||
|
port: 5432
|
||||||
|
host: localhost
|
||||||
|
|
||||||
|
gitea_version: 1.20.2
|
||||||
|
|
||||||
|
gitea_source: https://dl.gitea.io/gitea
|
||||||
|
gitea_arch: linux-amd64
|
||||||
|
|
||||||
|
gitea_domain: localhost
|
||||||
|
gitea_domain_protocol: https
|
||||||
|
gitea_port: 3000
|
||||||
|
gitea_ssh_domain: localhost
|
||||||
|
|
||||||
|
gitea_internal_token: INTERNAL_TOKEN
|
||||||
|
gitea_jwt_secret: JWT_SECRET
|
||||||
|
gitea_secret_key: SECRET_KEY
|
||||||
|
|
||||||
|
gitea_mail: true
|
||||||
|
gitea_mail_type: smtps
|
||||||
|
gitea_mail_tls: true
|
||||||
|
gitea_mail_domain: mail.my-domain.tld
|
||||||
|
gitea_mail_port: 465
|
||||||
|
gitea_mail_user: user@my-domain.tld
|
||||||
|
gitea_mail_from: "{{ gitea_mail_user }}"
|
||||||
|
gitea_mail_pass: ThisCouldBeYourAdd
|
||||||
|
|
||||||
|
gitea_admin_user: gitea_adm
|
||||||
|
gitea_admin_pass: gitea_fancy_adm_password!
|
||||||
|
gitea_admin_mail: "{{ gitea_mail_user }}"
|
||||||
18
handlers/main.yml
Executable file
18
handlers/main.yml
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
- name: restart gitea
|
||||||
|
systemd:
|
||||||
|
name: gitea
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: generate admin user
|
||||||
|
command:
|
||||||
|
cmd: |
|
||||||
|
{{ gitea_link }}/gitea admin user create
|
||||||
|
--admin
|
||||||
|
--username {{ gitea_admin_user }}
|
||||||
|
--password '{{ gitea_admin_pass }}'
|
||||||
|
--email {{ gitea_admin_mail }}
|
||||||
|
--config {{ gitea_home }}/app.ini
|
||||||
|
--work-path {{ gitea_data_location }}
|
||||||
|
become: yes
|
||||||
|
become_user: "{{ gitea_usr }}"
|
||||||
15
meta/main.yml
Executable file
15
meta/main.yml
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
role_name: gitea
|
||||||
|
namespace: hahn-cloud
|
||||||
|
author: Lars Hahn
|
||||||
|
company: OpenDevChain
|
||||||
|
license: MIT
|
||||||
|
description: Role to setup gitea Git Server
|
||||||
|
min_ansible_version: 2.7
|
||||||
|
platforms:
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- 11
|
||||||
|
galaxy_tags:
|
||||||
|
- gitea
|
||||||
90
tasks/main.yml
Executable file
90
tasks/main.yml
Executable file
@ -0,0 +1,90 @@
|
|||||||
|
---
|
||||||
|
- name: install Gitea recommendations
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
||||||
|
install_recommends: yes
|
||||||
|
pkg:
|
||||||
|
- "git"
|
||||||
|
|
||||||
|
- name: setup gitea group
|
||||||
|
group:
|
||||||
|
name: "{{ gitea_usr }}"
|
||||||
|
state: "present"
|
||||||
|
|
||||||
|
- name: setup gitea user
|
||||||
|
user:
|
||||||
|
name: "{{ gitea_usr }}"
|
||||||
|
home: "{{ gitea_home }}"
|
||||||
|
group: "{{ gitea_grp }}"
|
||||||
|
groups:
|
||||||
|
- "{{ gitea_grp }}"
|
||||||
|
comment: Virtual Gitea User
|
||||||
|
shell: /bin/bash
|
||||||
|
state: present
|
||||||
|
system: yes
|
||||||
|
|
||||||
|
- name: setup gitea directories
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ item }}"
|
||||||
|
owner: "{{ gitea_usr }}"
|
||||||
|
group: "{{ gitea_grp }}"
|
||||||
|
mode: 0750
|
||||||
|
loop:
|
||||||
|
- "{{ gitea_inst }}"
|
||||||
|
- "{{ gitea_home }}"
|
||||||
|
- "{{ gitea_data_location }}"
|
||||||
|
- "{{ gitea_data_location }}/custom"
|
||||||
|
- "{{ gitea_data_location }}/data"
|
||||||
|
- "{{ gitea_data_location }}/log"
|
||||||
|
|
||||||
|
- name: setup gitea config directories
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ item }}"
|
||||||
|
owner: "root"
|
||||||
|
group: "{{ gitea_grp }}"
|
||||||
|
mode: 0770
|
||||||
|
loop:
|
||||||
|
- "/etc/gitea"
|
||||||
|
|
||||||
|
- name: setup gitea installation link
|
||||||
|
file:
|
||||||
|
state: link
|
||||||
|
src: "{{ gitea_inst }}"
|
||||||
|
dest: "{{ gitea_link }}"
|
||||||
|
owner: "{{ gitea_usr }}"
|
||||||
|
group: "{{ gitea_grp }}"
|
||||||
|
mode: 0750
|
||||||
|
|
||||||
|
- name: download gitea
|
||||||
|
get_url:
|
||||||
|
url: "{{ gitea_source }}/{{ gitea_version }}/gitea-{{ gitea_version }}-{{ gitea_arch }}"
|
||||||
|
dest: "{{ gitea_link }}/gitea"
|
||||||
|
owner: "{{ gitea_usr }}"
|
||||||
|
group: "{{ gitea_grp }}"
|
||||||
|
mode: 0775
|
||||||
|
notify: generate admin user
|
||||||
|
|
||||||
|
- name: setup gitea application ini
|
||||||
|
template:
|
||||||
|
src: opt/gitea/home/app.ini.j2
|
||||||
|
dest: "{{ gitea_home }}/app.ini"
|
||||||
|
owner: root
|
||||||
|
group: "{{ gitea_grp }}"
|
||||||
|
mode: 0660
|
||||||
|
notify: restart gitea
|
||||||
|
|
||||||
|
- name: setup gitea systemd unit
|
||||||
|
template:
|
||||||
|
src: etc/systemd/system/gitea.service.j2
|
||||||
|
dest: /etc/systemd/system/gitea.service
|
||||||
|
notify: restart gitea
|
||||||
|
|
||||||
|
- name: enable gitea systemd unit
|
||||||
|
systemd:
|
||||||
|
name: gitea
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
state: started
|
||||||
27
templates/etc/systemd/system/gitea.service.j2
Executable file
27
templates/etc/systemd/system/gitea.service.j2
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Gitea (Git with a cup of tea)
|
||||||
|
After=syslog.target
|
||||||
|
After=network.target
|
||||||
|
Wants=postgresql.service
|
||||||
|
After=postgresql.service
|
||||||
|
#Wants=memcached.service
|
||||||
|
#After=memcached.service
|
||||||
|
#Wants=redis.service
|
||||||
|
#After=redis.service
|
||||||
|
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
#LimitMEMLOCK=infinity
|
||||||
|
#LimitNOFILE=65535
|
||||||
|
RestartSec=2s
|
||||||
|
Type=simple
|
||||||
|
User={{ gitea_usr }}
|
||||||
|
Group={{ gitea_grp }}
|
||||||
|
WorkingDirectory={{ gitea_data_location }}
|
||||||
|
ExecStart={{ gitea_link }}/gitea web --config {{ gitea_home }}/app.ini
|
||||||
|
Restart=always
|
||||||
|
Environment=USER={{ gitea_usr }} HOME={{ gitea_home }} GITEA_WORK_DIR={{ gitea_data_location }}
|
||||||
|
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
82
templates/opt/gitea/home/app.ini.j2
Executable file
82
templates/opt/gitea/home/app.ini.j2
Executable file
@ -0,0 +1,82 @@
|
|||||||
|
APP_NAME = gitea@{{ gitea_ssh_domain }}
|
||||||
|
RUN_USER = {{ gitea_usr }}
|
||||||
|
RUN_MODE = {{ cloud_stage }}
|
||||||
|
|
||||||
|
[database]
|
||||||
|
DB_TYPE = {{ gitea_dbtype_mapping[gitea_db.type] | default('mysql') }}
|
||||||
|
HOST = {{ gitea_db.host | default('localhost') }}:{{ gitea_db.port | default(5432) }}
|
||||||
|
NAME = {{ gitea_db.name }}
|
||||||
|
USER = {{ gitea_db.user }}
|
||||||
|
PASSWD = `{{ gitea_db.pass }}`
|
||||||
|
SCHEMA =
|
||||||
|
SSL_MODE = disable
|
||||||
|
CHARSET = utf8
|
||||||
|
PATH = {{ gitea_data_location }}/data/gitea.db
|
||||||
|
LOG_SQL = false
|
||||||
|
|
||||||
|
[repository]
|
||||||
|
ROOT = {{ gitea_data_location }}/data/gitea-repositories
|
||||||
|
|
||||||
|
[server]
|
||||||
|
SSH_DOMAIN = {{ gitea_ssh_domain }}
|
||||||
|
DOMAIN = {{ gitea_domain }}
|
||||||
|
HTTP_PORT = {{ gitea_port | default(3000) }}
|
||||||
|
ROOT_URL = {{ gitea_domain_protocol }}://{{ gitea_ssh_domain }}/
|
||||||
|
DISABLE_SSH = {{ gitea_ssh | default('false') }}
|
||||||
|
SSH_PORT = {{ gitea_ssh_show_port | default(22) }}
|
||||||
|
SSH_LISTEN_PORT = {{ ssh_port | default(22) }}
|
||||||
|
LFS_START_SERVER = {{ gitea_lfs | default('true') }}
|
||||||
|
LFS_JWT_SECRET = `{{ gitea_jwt_secret }}`
|
||||||
|
OFFLINE_MODE = {{ gitea_is_offline | default('false') }}
|
||||||
|
LANDING_PAGE = {{ gitea_landing_page | default('explore') }}
|
||||||
|
|
||||||
|
[lfs]
|
||||||
|
PATH = {{ gitea_data_location }}/data/lfs
|
||||||
|
|
||||||
|
[mailer]
|
||||||
|
ENABLED = {{ gitea_mail }}
|
||||||
|
FROM = {{ gitea_mail_from }}
|
||||||
|
PROTOCOL = {{ gitea_mail_type }}
|
||||||
|
SMTP_ADDR = {{ gitea_mail_domain }}:{{ gitea_mail_port }}
|
||||||
|
USER = {{ gitea_mail_user }}
|
||||||
|
PASSWD = `{{ gitea_mail_pass }}`
|
||||||
|
|
||||||
|
[service]
|
||||||
|
REGISTER_EMAIL_CONFIRM = true
|
||||||
|
ENABLE_NOTIFY_MAIL = true
|
||||||
|
DISABLE_REGISTRATION = true
|
||||||
|
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
|
||||||
|
ENABLE_CAPTCHA = false
|
||||||
|
REQUIRE_SIGNIN_VIEW = false
|
||||||
|
DEFAULT_KEEP_EMAIL_PRIVATE = true
|
||||||
|
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||||
|
DEFAULT_ENABLE_TIMETRACKING = true
|
||||||
|
NO_REPLY_ADDRESS = noreply.{{ gitea_ssh_domain }}
|
||||||
|
|
||||||
|
[picture]
|
||||||
|
DISABLE_GRAVATAR = false
|
||||||
|
ENABLE_FEDERATED_AVATAR = true
|
||||||
|
|
||||||
|
[openid]
|
||||||
|
ENABLE_OPENID_SIGNIN = false
|
||||||
|
ENABLE_OPENID_SIGNUP = false
|
||||||
|
|
||||||
|
[oauth2_client]
|
||||||
|
ENABLE_AUTO_REGISTRATION = true
|
||||||
|
UPDATE_AVATAR = true
|
||||||
|
ACCOUNT_LINKING = auto
|
||||||
|
|
||||||
|
[session]
|
||||||
|
PROVIDER = file
|
||||||
|
|
||||||
|
[log]
|
||||||
|
MODE = file
|
||||||
|
LEVEL = info
|
||||||
|
ROOT_PATH = {{ gitea_data_location }}/log
|
||||||
|
logger.router.MODE = file
|
||||||
|
|
||||||
|
[security]
|
||||||
|
INSTALL_LOCK = true
|
||||||
|
INTERNAL_TOKEN = `{{ gitea_internal_token }}`
|
||||||
|
SECRET_KEY = `{{ gitea_secret_key }}`
|
||||||
|
PASSWORD_HASH_ALGO = pbkdf2
|
||||||
13
vars/main.yml
Executable file
13
vars/main.yml
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
gitea_usr: gitea
|
||||||
|
gitea_grp: "{{ gitea_usr }}"
|
||||||
|
|
||||||
|
gitea_link: "{{ cloud_apps }}/gitea/inst"
|
||||||
|
gitea_inst: "{{ cloud_apps }}/gitea/gitea-{{ gitea_version }}"
|
||||||
|
gitea_home: "{{ cloud_apps }}/gitea/home"
|
||||||
|
|
||||||
|
gitea_dbtype_mapping: {
|
||||||
|
'pgsql': 'postgres',
|
||||||
|
'mariadb': 'mysql',
|
||||||
|
'mysql': 'mysql'
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user