浏览代码

switch to postresql as the database backend

master
父节点
当前提交
fe04c43bb6
共有 5 个文件被更改,包括 40 次插入5 次删除
  1. +3
    -1
      defaults/main.yml
  2. +16
    -0
      tasks/database.yaml
  3. +1
    -0
      tasks/main.yml
  4. +3
    -0
      tasks/setup.yaml
  5. +17
    -4
      vars/main.yml

+ 3
- 1
defaults/main.yml 查看文件

@@ -14,4 +14,6 @@ gitea_admin_username: testadmin
gitea_admin_password: testadmin
gitea_admin_email: admin@example.com

gitea_database_password: "{{ ansible_local.gitea.database_password }}"
gitea_db_name: gitea
gitea_db_user: gitea
gitea_db_pass: "{{ ansible_local.gitea.database_password }}"

+ 16
- 0
tasks/database.yaml 查看文件

@@ -0,0 +1,16 @@
---

- block:

- name: postgresql user
postgresql_user:
name: "{{gitea_db_user}}"
password: "{{gitea_db_pass}}"

- name: postgresql database
postgresql_db:
name: "{{gitea_db_name}}"
owner: "{{gitea_db_user}}"

become: true
become_user: postgres

+ 1
- 0
tasks/main.yml 查看文件

@@ -4,6 +4,7 @@
- import_tasks: setup.yaml
- import_tasks: download.yaml

- import_tasks: database.yaml
- import_tasks: deploy.yml

- name: flush handlers


+ 3
- 0
tasks/setup.yaml 查看文件

@@ -7,3 +7,6 @@
- git
- golang
- gnupg
- postgresql
- python-psycopg2
- autopostgresqlbackup

+ 17
- 4
vars/main.yml 查看文件

@@ -1,5 +1,5 @@
_gitea_local_facts:
database_password: "{% if not ansible_local.gitea.database_password is defined %}{{ lookup('password', '/dev/null length=15 chars=ascii_letters') }}{% else %}{{ ansible_local.gitea.database_password }}{% endif %}"
database_password: "{% if not ansible_local.gitea.database_password is defined %}{{ lookup('password', '/dev/null length=16 chars=ascii_letters') }}{% else %}{{ ansible_local.gitea.database_password }}{% endif %}"

_gitea_nginx_vhosts:
- name: gitea
@@ -45,11 +45,24 @@ _gitea_config:

- section: database
option: DB_TYPE
value: sqlite3
value: postgres

- section: database
option: PATH
value: "/var/lib/gitea/data/gitea.db"
option: HOST
value: localhost
#value: "/run/postgresql/"

- section: database
option: NAME
value: "{{gitea_db_name}}"

- section: database
option: USER
value: "{{gitea_db_user}}"

- section: database
option: PASSWD
value: "{{gitea_db_pass}}"

- section: log
option: ROOT_PATH


正在加载...
取消
保存