postgres gitea

This commit is contained in:
vincent 2020-09-08 21:04:56 +02:00
parent 72b0bd14b9
commit 390b987690
5 changed files with 60 additions and 26 deletions

View File

@ -14,7 +14,7 @@ gitea_http_port: 3000
gitea_disable_http_git: false gitea_disable_http_git: false
gitea_offline_mode: true gitea_offline_mode: true
gitea_db_type: mysql gitea_db_type: postgres # mysql or postgres
gitea_db_host: 127.0.0.0:3306 gitea_db_host: 127.0.0.0:3306
gitea_db_name: gitea gitea_db_name: gitea
gitea_db_user: gitea gitea_db_user: gitea

View File

@ -1,4 +1,3 @@
dependencies: dependencies:
- nginx - nginx
- php - php
- mariadb

25
tasks/database_mysql.yml Normal file
View File

@ -0,0 +1,25 @@
- name: "Ensure database is present"
become: yes
mysql_db:
name: "{{ gitea_db_name }}"
collation: utf8mb4_unicode_ci
encoding: utf8mb4
state: present
register: gitea_database_creation
- name: import DATA in database in case of creation
become: yes
mysql_db:
name: "{{ gitea_db_name }}"
state: import
target: "{{gitea_SQl_target_file}}"
when: gitea_database_creation.changed == true and gitea_SQl_target_file is defined
- name: "Ensure db user is present"
become: yes
mysql_user:
name: "{{ gitea_db_user }}"
host: localhost
password: "{{ gitea_db_password }}"
priv: "{{ gitea_db_name }}.*:ALL"
state: present

View File

@ -0,0 +1,29 @@
- name: "Ensure db user is present"
become: yes
become_user: postgres
postgresql_user:
name: "{{ gitea_db_user }}"
password: "{{ gitea_db_password }}"
state: present
- name: "Ensure database is present"
become: yes
become_user: postgres
postgresql_db:
name: "{{ gitea_db_name }}"
lc_collate: fr_FR.UTF-8
encoding: utf8
owner: "{{ gitea_db_user }}"
state: present
register: gitea_database_creation
- name: import DATA in database in case of creation
become: yes
become_user: postgres
postgresql_db:
name: "{{ gitea_db_name }}"
state: restore
target: "{{ gitea_SQl_target_file }}"
register: gitea_database_import
when: gitea_database_creation.changed == true and gitea_SQl_target_file is defined

View File

@ -1,28 +1,9 @@
- name: "Ensure database is present"
become: yes
mysql_db:
name: "{{ gitea_db_name }}"
collation: utf8mb4_unicode_ci
encoding: utf8mb4
state: present
register: gitea_database_creation
- name: import DATA in database in case of creation
become: yes
mysql_db:
name: "{{ gitea_db_name }}"
state: import
target: "{{gitea_SQl_target_file}}"
when: gitea_database_creation.changed == true and gitea_SQl_target_file is defined
- name: "Ensure db user is present" - name: select specific Database tasks
become: yes include_tasks: "database_{{gitea_db_type}}.yml"
mysql_user:
name: "{{ gitea_db_user }}"
host: localhost
password: "{{ gitea_db_password }}"
priv: "{{ gitea_db_name }}.*:ALL"
state: present
- name: install gitea - name: install gitea
pacman: pacman: