1
1
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_gitea.git synced 2024-08-16 11:39:50 +02:00
ansible_role_gitea/tasks/main.yml

87 lines
2.4 KiB
YAML
Raw Normal View History

---
2022-09-29 23:09:19 +02:00
- name: Perform optional versionscheck
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "versioncheck.yml"
when: submodules_versioncheck|bool
2021-04-12 16:01:24 +02:00
- name: Gather installed packages for checks later on
ansible.builtin.package_facts:
2024-03-03 12:42:22 +01:00
manager: "auto"
2023-01-26 22:35:10 +01:00
- name: Prepare gitea/forgejo variable import
block:
- name: Gather variables for gitea or forgejo
2023-10-29 16:11:12 +01:00
ansible.builtin.include_vars:
file: "{{ lookup('first_found', gitea_fork_variables) }}"
2023-01-26 22:35:10 +01:00
rescue:
- name: Gitea/Forejo import info
ansible.builtin.fail:
msg: "Currently only {{ gitea_supported_forks }} are supported."
Improve ARM Support (#74) * Gitea user should be a system user * Improve installation system * Download archive instead of binary * Add checksum validation * Add GPG check * Add backup process before upgrading * Improve ARM support * Improve support for Vault Encrypted JWT tokens * Fix spacing in gitea configuration template When Gitea rewrite the configuration file (e.g.: the JWT token is not set or doesn't fit their criteria), it'll align space on a per-section basis in the .ini file. If the template is not properly spaced, at the next Ansible run, you'll have an enormous diff, hidding what the real changes are. * add proper redhat/debian deps for molecule testing * Gitea group should be a system group * fix linting for CI * Update CI and meta information for up-to-date tests and distros * molecule: fix typo for redhat packages * fix typo * bump gitea version to 1.13.1 * Use Ubuntu keyservers to play nicely with everyone * Update minimum required ansible version to 2.9.8 This is required for Ubuntu Focal, which comes with systemd >= 245 The Get Facts modules doesn't work well with it before the bugfix introduced in 2.9.8 * Replace yes by True to please the linting * Truthy values needs to be lower-case * bump gitea version to 1.13.2 * perform gitea dump as gitea user * need to set become to yes * autogenerate JWT_SECRETS (#77) * autogenerate JWT_SECRETS Based on https://docs.gitea.io/en-us/command-line/#generate we will now autogenerate JWT_SECRETS if they are not defined. In my opinion a much better idea than writing a value in the default config. The check if the variables for the secrets are now 43 characters long i took out. Gitea generates itself suitable secrets, if the user given ones do not fit. * drop ansible.builtin. syntax * Update file permissions for "{{ gitea_home }}" (#75) The file permissions for {{ gitea_home }} especially in conjunction with the recurse: true flag are on closer inspection very open to all and also have a +x set on files. This should be done better. And I have done here now. By the way: To improve the -x on normal files in his gitea installation this shell command was useful for me ``` find . -type f -exec chmod a-x {} \+; find . -type f -exec chmod u=rwX {} \+; ``` * Bump cryptography from 3.2 to 3.3.2 (#79) Bumps [cryptography](https://github.com/pyca/cryptography) from 3.2 to 3.3.2. - [Release notes](https://github.com/pyca/cryptography/releases) - [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/3.2...3.3.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Gitea user should be a system user * Improve installation system * Download archive instead of binary * Add checksum validation * Add GPG check * Add backup process before upgrading * Improve ARM support * Fix spacing in gitea configuration template When Gitea rewrite the configuration file (e.g.: the JWT token is not set or doesn't fit their criteria), it'll align space on a per-section basis in the .ini file. If the template is not properly spaced, at the next Ansible run, you'll have an enormous diff, hidding what the real changes are. * add proper redhat/debian deps for molecule testing * Gitea group should be a system group * fix linting for CI * Update CI and meta information for up-to-date tests and distros * molecule: fix typo for redhat packages * fix typo * bump gitea version to 1.13.1 * Use Ubuntu keyservers to play nicely with everyone * Update minimum required ansible version to 2.9.8 This is required for Ubuntu Focal, which comes with systemd >= 245 The Get Facts modules doesn't work well with it before the bugfix introduced in 2.9.8 * Replace yes by True to please the linting * Truthy values needs to be lower-case * bump gitea version to 1.13.2 * perform gitea dump as gitea user * need to set become to yes * check-variables.yml doesn't exists anymore Co-authored-by: L3D <l3d@c3woc.de> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-12 18:56:31 +01:00
- name: Gather variables for each operating system
2023-10-29 16:11:12 +01:00
ansible.builtin.include_vars:
file: "{{ lookup('first_found', gitea_variables) }}"
- name: Gather versioning information
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
file: "set_{{ gitea_fork | lower }}_version.yml"
2022-09-29 23:09:19 +02:00
- name: Backup gitea before update
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "backup.yml"
when: gitea_backup_on_upgrade|bool
2024-01-12 01:14:31 +01:00
- name: Create gitea user and group
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "create_user.yml"
2017-01-10 22:09:34 +01:00
- name: "Install or update {{ gitea_fork }}"
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
file: "install_{{ gitea_fork | lower }}.yml"
- name: Create directories
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "directory.yml"
2017-01-10 22:09:34 +01:00
2022-09-29 23:09:19 +02:00
- name: Setup gitea systemd service
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "install_systemd.yml"
2017-01-10 22:09:34 +01:00
when: ansible_service_mgr == "systemd"
2022-09-29 23:09:19 +02:00
- name: Generate JWT Secrets if undefined
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "jwt_secrets.yml"
2022-09-29 23:09:19 +02:00
- name: Generate gitea secrets if undefined
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "gitea_secrets.yml"
2022-09-29 23:09:19 +02:00
- name: Configure gitea
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "configure.yml"
2017-01-10 22:09:34 +01:00
2022-09-29 23:09:19 +02:00
- name: Deploy optional fail2ban rules
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "fail2ban.yml"
2023-10-29 16:11:12 +01:00
when: gitea_fail2ban_enabled | bool
2021-06-03 17:59:14 +02:00
2022-09-29 23:09:19 +02:00
- name: Optionally customize gitea
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "customize_logo.yml"
2023-10-29 16:11:12 +01:00
when: gitea_customize_logo | bool
2021-06-03 21:06:04 +02:00
2022-09-29 23:09:19 +02:00
- name: Optionally customize footer
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "customize_footer.yml"
2023-10-29 16:11:12 +01:00
when: gitea_customize_footer | bool
2021-06-03 22:51:28 +02:00
2022-09-29 23:09:19 +02:00
- name: Optionally deploy public files
2023-10-29 16:11:12 +01:00
ansible.builtin.include_tasks:
2024-03-03 12:42:22 +01:00
file: "customize_public_files.yml"
when: gitea_customize_files | bool or gitea_custom_themes is defined
- name: Optionally create local Users on git instance
ansible.builtin.include_tasks:
file: 'local_git_users.yml'
when: gitea_users | length > 0