add regenerate key handler

This commit is contained in:
vincent 2021-07-19 23:14:45 +02:00
parent 85daaa8730
commit 6d14444631
3 changed files with 12 additions and 4 deletions

View File

@ -17,3 +17,10 @@
state: restarted state: restarted
when: ansible_service_mgr == "systemd" when: ansible_service_mgr == "systemd"
become: yes become: yes
- name: "regenerate keys"
command:
cmd: gitea admin -c /etc/gitea/app.ini regenerate keys
chdir: /usr/lib/gitea
become: true
become_user: "{{ gitea_user }}"

View File

@ -13,6 +13,7 @@
name: "{{ gitea_db_name }}" name: "{{ gitea_db_name }}"
state: import state: import
target: "{{gitea_SQl_target_file}}" target: "{{gitea_SQl_target_file}}"
notify: "regenerate keys"
when: gitea_database_creation.changed == true and gitea_SQl_target_file is defined when: gitea_database_creation.changed == true and gitea_SQl_target_file is defined
- name: "Ensure db user is present" - name: "Ensure db user is present"

View File

@ -1,7 +1,7 @@
- name: "Ensure db user is present" - name: "Ensure db user is present"
become: yes become: yes
become_user: postgres become_user: postgres
postgresql_user: postgresql_user:
name: "{{ gitea_db_user }}" name: "{{ gitea_db_user }}"
password: "{{ gitea_db_password }}" password: "{{ gitea_db_password }}"
state: present state: present
@ -9,7 +9,7 @@
- name: "Ensure database is present" - name: "Ensure database is present"
become: yes become: yes
become_user: postgres become_user: postgres
postgresql_db: postgresql_db:
name: "{{ gitea_db_name }}" name: "{{ gitea_db_name }}"
lc_collate: fr_FR.UTF-8 lc_collate: fr_FR.UTF-8
encoding: utf8 encoding: utf8
@ -18,7 +18,6 @@
state: present state: present
register: gitea_database_creation register: gitea_database_creation
- name: import DATA in database in case of creation - name: import DATA in database in case of creation
become: yes become: yes
become_user: postgres become_user: postgres
@ -27,4 +26,5 @@
state: restore state: restore
target: "{{ gitea_SQl_target_file }}" target: "{{ gitea_SQl_target_file }}"
register: gitea_database_import register: gitea_database_import
when: gitea_database_creation.changed == true and gitea_SQl_target_file is defined notify: "regenerate keys"
when: gitea_database_creation.changed == true and gitea_SQl_target_file is defined