2019-03-16 06:51:32 -05:00
|
|
|
---
|
2020-04-04 07:06:25 -05:00
|
|
|
|
|
|
|
- include: check-variables.yml
|
|
|
|
|
2019-04-27 19:00:35 -05:00
|
|
|
- name: "Check gitea version"
|
2019-04-30 13:16:33 -05:00
|
|
|
shell: "set -eo pipefail; /usr/local/bin/gitea -v | cut -d' ' -f 3"
|
2020-06-16 01:53:32 -05:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2019-04-27 19:00:35 -05:00
|
|
|
register: gitea_active_version
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2019-05-22 02:30:09 -05:00
|
|
|
when: gitea_version_check|bool
|
2019-04-27 19:00:35 -05:00
|
|
|
|
2017-01-10 15:09:34 -06:00
|
|
|
- name: "Download the binary"
|
|
|
|
get_url:
|
2020-05-17 08:56:23 -05:00
|
|
|
url: "{{ gitea_dl_url }}"
|
2017-01-10 15:09:34 -06:00
|
|
|
dest: /usr/local/bin/gitea
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
2019-03-16 06:51:32 -05:00
|
|
|
force: true
|
2017-01-10 15:09:34 -06:00
|
|
|
notify: "Restart gitea"
|
2020-05-10 15:35:05 -05:00
|
|
|
when: (not gitea_version_check|bool) or (not ansible_check_mode and (gitea_active_version.stdout != gitea_version))
|
2017-01-10 15:09:34 -06:00
|
|
|
|
|
|
|
- include: create_user.yml
|
|
|
|
|
|
|
|
- name: "Create config and data directory"
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ gitea_user }}"
|
2021-01-16 15:21:05 -06:00
|
|
|
mode: '0755'
|
2021-01-16 15:36:41 -06:00
|
|
|
recurse: true
|
2017-01-10 15:09:34 -06:00
|
|
|
with_items:
|
|
|
|
- "/etc/gitea"
|
|
|
|
- "{{ gitea_home }}"
|
|
|
|
- "{{ gitea_home }}/data"
|
|
|
|
- "{{ gitea_home }}/custom"
|
|
|
|
- "{{ gitea_home }}/custom/https"
|
|
|
|
- "{{ gitea_home }}/custom/mailer"
|
2020-08-15 18:33:06 -05:00
|
|
|
- "{{ gitea_home }}/indexers"
|
2020-09-18 05:11:42 -05:00
|
|
|
- "{{ gitea_home }}/log"
|
2017-01-10 15:09:34 -06:00
|
|
|
|
|
|
|
- include: install_systemd.yml
|
|
|
|
when: ansible_service_mgr == "systemd"
|
|
|
|
|
2020-08-15 18:43:52 -05:00
|
|
|
- name: 'Install git'
|
|
|
|
package:
|
|
|
|
name: 'git'
|
|
|
|
state: 'present'
|
|
|
|
|
2017-01-10 15:09:34 -06:00
|
|
|
- name: "Configure gitea"
|
|
|
|
template:
|
|
|
|
src: gitea.ini.j2
|
|
|
|
dest: /etc/gitea/gitea.ini
|
|
|
|
owner: "{{ gitea_user }}"
|
|
|
|
mode: 0600
|
|
|
|
notify: "Restart gitea"
|
|
|
|
|
|
|
|
- name: "Service gitea"
|
|
|
|
service:
|
|
|
|
name: gitea
|
|
|
|
state: started
|
|
|
|
enabled: true
|
2019-03-16 06:51:32 -05:00
|
|
|
when: ansible_service_mgr == "systemd"
|
2019-03-08 06:12:16 -06:00
|
|
|
|
|
|
|
- include: fail2ban.yml
|
2019-05-22 02:30:09 -05:00
|
|
|
when: gitea_fail2ban_enabled|bool
|