diff --git a/handlers/main.yml b/handlers/main.yml index 698d94d..651baf1 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -17,10 +17,3 @@ state: restarted when: ansible_service_mgr == "systemd" become: yes - -- name: "regenerate keys" - command: - cmd: gitea admin -c /etc/gitea/app.ini regenerate keys - chdir: /var/lib/gitea - become: true - become_user: "{{ gitea_user }}" diff --git a/tasks/database_postgres.yml b/tasks/database_postgres.yml index e6a28d3..dbcfb61 100644 --- a/tasks/database_postgres.yml +++ b/tasks/database_postgres.yml @@ -26,5 +26,4 @@ state: restore target: "{{ gitea_SQl_target_file }}" register: gitea_database_import - notify: "regenerate keys" when: gitea_database_creation.changed == true and gitea_SQl_target_file is defined diff --git a/tasks/main.yml b/tasks/main.yml index 6cc01a1..1ff5b07 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,17 +1,12 @@ - - - name: select specific Database tasks include_tasks: "database_{{gitea_db_type}}.yml" - - - name: install gitea pacman: - state: present # not required. choices: absent;latest;present. Desired state of the package. - force: false # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. - name: gitea + state: present # not required. choices: absent;latest;present. Desired state of the package. + force: false # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. + name: gitea become: yes - - name: "Configure gitea" template: @@ -24,14 +19,14 @@ - name: create custom systemd folder file: - path: /etc/systemd/system/gitea.service.d/ # required. Path to the file being managed. - state: directory # not required. choices: absent;directory;file;hard;link;touch. If C(directory), all intermediate subdirectories will be created if they do not exist. Since Ansible 1.7 they will be created with the supplied permissions. If C(file), the file will NOT be created if it does not exist; see the C(touch) value or the M(copy) or M(template) module if you want that behavior. If C(link), the symbolic link will be created or changed. Use C(hard) for hardlinks. If C(absent), directories will be recursively deleted, and files or symlinks will be unlinked. Note that C(absent) will not cause C(file) to fail if the C(path) does not exist as the state did not change. If C(touch) (new in 1.4), an empty file will be created if the C(path) does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way `touch` works from the command line). + path: /etc/systemd/system/gitea.service.d/ # required. Path to the file being managed. + state: directory # not required. choices: absent;directory;file;hard;link;touch. If C(directory), all intermediate subdirectories will be created if they do not exist. Since Ansible 1.7 they will be created with the supplied permissions. If C(file), the file will NOT be created if it does not exist; see the C(touch) value or the M(copy) or M(template) module if you want that behavior. If C(link), the symbolic link will be created or changed. Use C(hard) for hardlinks. If C(absent), directories will be recursively deleted, and files or symlinks will be unlinked. Note that C(absent) will not cause C(file) to fail if the C(path) does not exist as the state did not change. If C(touch) (new in 1.4), an empty file will be created if the C(path) does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way `touch` works from the command line). become: yes - name: apply override file for systemd template: - dest: /etc/systemd/system/gitea.service.d/override.conf # required. Location to render the template to on the remote machine. - src: override.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path. + dest: /etc/systemd/system/gitea.service.d/override.conf # required. Location to render the template to on the remote machine. + src: override.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path. notify: "Restart gitea" become: yes @@ -43,6 +38,13 @@ when: ansible_service_mgr == "systemd" become: yes +- name: "regenerate keys" + command: + cmd: gitea admin -c /etc/gitea/app.ini regenerate keys + chdir: /var/lib/gitea + become: true + become_user: "{{ gitea_user }}" + when: gitea_database_import.changed == true - name: Install fail2ban jail template: