152 lines
4.4 KiB
YAML
152 lines
4.4 KiB
YAML
---
|
|
- hosts: all
|
|
gather_facts: false
|
|
tasks:
|
|
- name: Load variables
|
|
include_vars:
|
|
dir: "{{ dokku_lib_root }}/data/ansible/gitea/vars/"
|
|
extensions:
|
|
- yml
|
|
|
|
- name: Prepare Python system dependencies
|
|
become: true
|
|
apt:
|
|
name: python3-pip
|
|
state: present
|
|
|
|
- name: Install dns-lexicon[gandi] system wide
|
|
become: true
|
|
pip:
|
|
name: "{{ item }}"
|
|
executable: /usr/bin/pip3
|
|
state: present
|
|
with_items:
|
|
- cryptography==2.8
|
|
- dns-lexicon==3.3.19
|
|
|
|
- name: "Create {{ domain }} DNS entry"
|
|
gandi_dns:
|
|
gandi_rest_token: "{{ gandi_rest_token }}"
|
|
domain: "{{ domain }}"
|
|
ipv4: "{{ dokku_domain_ipv4 }}"
|
|
state: present
|
|
|
|
- name: "Configure the {{ domain }} domain"
|
|
dokku_domains:
|
|
app: gitea
|
|
domains:
|
|
- "{{ domain }}"
|
|
state: present
|
|
|
|
- name: Create mariadb database
|
|
shell: "
|
|
dokku
|
|
mariadb:create
|
|
gitea
|
|
--password {{ db_passwd }}
|
|
--root-password {{ root_db_passwd }}
|
|
"
|
|
args:
|
|
creates: /var/lib/dokku/services/mariadb/gitea
|
|
|
|
- name: Link mariadb database to application
|
|
dokku_service_link:
|
|
app: gitea
|
|
name: gitea
|
|
service: mariadb
|
|
|
|
# - name: Authenticate with Minio back-end
|
|
# - name: Configure daily backup policy
|
|
# - name: Take pre-deploy backup
|
|
|
|
- name: Setup host git user
|
|
user:
|
|
name: git
|
|
comment: gitea user
|
|
create_home: true
|
|
home: /home/git
|
|
group: git
|
|
system: true
|
|
state: present
|
|
generate_ssh_key: true
|
|
ssh_key_bits: 2048
|
|
ssh_key_file: .ssh/id_rsa
|
|
become: true
|
|
|
|
- name: Create application directories
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: git
|
|
group: git
|
|
with_items:
|
|
- /app
|
|
- /app/gitea
|
|
- /var/lib/gitea
|
|
become: true
|
|
|
|
- name: Get uid/guid of the git user
|
|
getent:
|
|
database: passwd
|
|
key: git
|
|
split: ":"
|
|
become: true
|
|
|
|
- name: Specify docker volume mounts
|
|
dokku_storage:
|
|
app: gitea
|
|
mounts:
|
|
- /var/lib/gitea:/data
|
|
- /etc/timezone:/etc/timezone:ro
|
|
- /etc/localtime:/etc/localtime:ro
|
|
- /var/lib/dokku/services/mariadb/gitea:/var/lib/mysql
|
|
- /var/lib/gitea/.ssh:/data/git/.ssh
|
|
|
|
- name: Store gitea git user uid/guid
|
|
set_fact:
|
|
git_user_uid: "{{ getent_passwd['git'][1] }}"
|
|
git_user_guid: "{{ getent_passwd['git'][2] }}"
|
|
|
|
- name: Configure the dokku app environment
|
|
dokku_config:
|
|
app: gitea
|
|
restart: false
|
|
config:
|
|
ADMIN_MAIL: "{{ autonomic_admin_mail }}"
|
|
ADMIN_PASS: "{{ autonomic_admin_pass }}"
|
|
ADMIN_USER: "{{ autonomic_admin_user }}"
|
|
ALLOW_ONLY_EXTERNAL_REGISTRATION: "{{ allow_only_external_registration }}"
|
|
APP_NAME: "{{ autonomic_app_name }}"
|
|
AUTHOR: "{{ author }}"
|
|
DB_HOST: "dokku-mariadb-gitea:3306"
|
|
DB_NAME: "gitea"
|
|
DB_PASSWD: "{{ db_passwd }}"
|
|
DB_TYPE: "mysql"
|
|
DB_USER: "mariadb" # https://github.com/dokku/dokku-mariadb/issues/89
|
|
DESCRIPTION: "{{ description }}"
|
|
DISABLE_REGISTRATION: "{{ disable_registration }}"
|
|
DOKKU_LETSENCRYPT_EMAIL: "{{ autonomic_admin_mail }}"
|
|
DOMAIN: "{{ domain }}"
|
|
ENABLE_OPENID_SIGNIN: "{{ enable_openid_signin }}"
|
|
ENABLE_OPENID_SIGNUP: "{{ enable_openid_signup }}"
|
|
GITEA_THEME: "{{ gitea_theme }}"
|
|
HTTP_PORT: "{{ http_port }}"
|
|
INSTALL_LOCK: "{{ install_lock }}"
|
|
JWT_SECRET: "{{ jwt_secret }}"
|
|
MAILER_ENABLED: "{{ mailer_enabled }}"
|
|
RUN_MODE: "prod"
|
|
SECRET_KEY: "{{ secret_key}}"
|
|
SMTP_FROM: "{{ smtp_from }}"
|
|
SMTP_HOST: "{{ smtp_host }}"
|
|
SMTP_MAILER_TYPE: "{{ smtp_mailer_type }}"
|
|
SMTP_PASSWD: "{{ smtp_passwd }}"
|
|
SMTP_TLS_ENABLED: "{{ smtp_tls_enabled }}"
|
|
SMTP_USER: "{{ smtp_user }}"
|
|
SSH_DOMAIN: "{{ ssh_domain }}"
|
|
SSH_LISTEN_PORT: "{{ ssh_listen_port }}"
|
|
SSH_PORT: "{{ ssh_port }}"
|
|
STARTUP_TIMEOUT: "{{ startup_timeout }}"
|
|
USER_GID: "{{ git_user_guid }}"
|
|
USER_UID: "{{ git_user_uid }}"
|
|
WHITELIST_URIS: "{{ whitelist_uris }}"
|