2019-03-16 12:51:32 +01:00
|
|
|
---
|
2019-04-28 02:00:35 +02:00
|
|
|
- name: "Check gitea version"
|
2019-04-30 20:16:33 +02:00
|
|
|
shell: "set -eo pipefail; /usr/local/bin/gitea -v | cut -d' ' -f 3"
|
2019-04-28 02:00:35 +02:00
|
|
|
register: gitea_active_version
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
when: gitea_version_check
|
|
|
|
|
2017-01-10 22:09:34 +01:00
|
|
|
- name: "Download the binary"
|
|
|
|
get_url:
|
2019-03-16 12:51:32 +01:00
|
|
|
url: "{{ gitea_dl_url }}/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_arch }}"
|
2017-01-10 22:09:34 +01:00
|
|
|
dest: /usr/local/bin/gitea
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
2019-03-16 12:51:32 +01:00
|
|
|
force: true
|
2017-01-10 22:09:34 +01:00
|
|
|
notify: "Restart gitea"
|
2019-04-30 20:16:33 +02:00
|
|
|
when: (not gitea_version_check) or (gitea_active_version.stdout != gitea_version)
|
2017-01-10 22:09:34 +01:00
|
|
|
|
|
|
|
- include: create_user.yml
|
|
|
|
|
|
|
|
- name: "Create config and data directory"
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ gitea_user }}"
|
|
|
|
with_items:
|
|
|
|
- "/etc/gitea"
|
|
|
|
- "{{ gitea_home }}"
|
|
|
|
- "{{ gitea_home }}/data"
|
|
|
|
- "{{ gitea_home }}/custom"
|
|
|
|
- "{{ gitea_home }}/custom/https"
|
|
|
|
- "{{ gitea_home }}/custom/mailer"
|
|
|
|
|
|
|
|
- include: install_systemd.yml
|
|
|
|
when: ansible_service_mgr == "systemd"
|
|
|
|
|
|
|
|
- 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 12:51:32 +01:00
|
|
|
when: ansible_service_mgr == "systemd"
|
2019-03-08 13:12:16 +01:00
|
|
|
|
|
|
|
- include: fail2ban.yml
|
2019-03-16 12:51:32 +01:00
|
|
|
when: gitea_fail2ban_enabled
|