database modif gitea

This commit is contained in:
vincent 2019-04-23 18:34:18 +02:00
parent af08d3575e
commit af511aeaa1
2 changed files with 27 additions and 1 deletions

View File

@ -21,7 +21,7 @@ gitea_db_user: gitea
gitea_db_password: lel gitea_db_password: lel
gitea_db_ssl: disable gitea_db_ssl: disable
gitea_db_path: "{{ gitea_home }}/data/gitea.db" gitea_db_path: "{{ gitea_home }}/data/gitea.db"
gitea_SQl_target_file: []
gitea_ssh_listen: 0.0.0.0 gitea_ssh_listen: 0.0.0.0
gitea_ssh_domain: localhost gitea_ssh_domain: localhost
gitea_start_ssh: false gitea_start_ssh: false

View File

@ -1,3 +1,29 @@
- 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: install gitea - name: install gitea
pacman: pacman:
state: present # not required. choices: absent;latest;present. Desired state of the package. state: present # not required. choices: absent;latest;present. Desired state of the package.