postgres gitea
This commit is contained in:
parent
72b0bd14b9
commit
390b987690
@ -14,7 +14,7 @@ gitea_http_port: 3000
|
||||
gitea_disable_http_git: false
|
||||
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_name: gitea
|
||||
gitea_db_user: gitea
|
||||
|
@ -1,4 +1,3 @@
|
||||
dependencies:
|
||||
- nginx
|
||||
- php
|
||||
- mariadb
|
25
tasks/database_mysql.yml
Normal file
25
tasks/database_mysql.yml
Normal 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
|
29
tasks/database_postgres.yml
Normal file
29
tasks/database_postgres.yml
Normal 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
|
@ -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"
|
||||
become: yes
|
||||
mysql_user:
|
||||
name: "{{ gitea_db_user }}"
|
||||
host: localhost
|
||||
password: "{{ gitea_db_password }}"
|
||||
priv: "{{ gitea_db_name }}.*:ALL"
|
||||
state: present
|
||||
- name: select specific Database tasks
|
||||
include_tasks: "database_{{gitea_db_type}}.yml"
|
||||
|
||||
|
||||
|
||||
- name: install gitea
|
||||
pacman:
|
||||
|
Loading…
Reference in New Issue
Block a user