2018-10-18 16:41:16 +00:00
|
|
|
- name: Create user gitea
|
|
|
|
user:
|
|
|
|
name: gitea
|
|
|
|
comment: Gitea daemon account
|
|
|
|
groups: gitea
|
|
|
|
home: "{{ gitea_root_directory }}"
|
|
|
|
|
2018-10-18 16:57:54 +00:00
|
|
|
- name: Create Gitea directory structure
|
2018-10-18 16:35:16 +00:00
|
|
|
file:
|
2018-10-18 16:50:17 +00:00
|
|
|
path: "{{ gitea_root_directory }}/{{item.item}}"
|
2018-10-18 16:35:16 +00:00
|
|
|
state: directory
|
2018-10-18 16:50:17 +00:00
|
|
|
owner: gitea
|
|
|
|
group: gitea
|
|
|
|
with_items: "{{ gitea_subdirectories }}"
|
2018-10-18 16:35:16 +00:00
|
|
|
|
2018-10-18 16:57:54 +00:00
|
|
|
- name: Make directories data, indexers, and log writable
|
|
|
|
file:
|
|
|
|
path: "{{ gitea_root_directory }}/{{item.item}}"
|
|
|
|
mode: 0750
|
|
|
|
with_items:
|
|
|
|
- data
|
|
|
|
- indexers
|
|
|
|
- log
|
|
|
|
|
|
|
|
- name: Create Gitea config directory
|
|
|
|
file:
|
|
|
|
path: /etc/gitea
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: gitea
|
|
|
|
mode: 0770
|
|
|
|
|
2018-10-18 07:26:39 +00:00
|
|
|
- name: Download Gitea binary
|
|
|
|
get_url:
|
|
|
|
url: "{{ gitea_download_url }}"
|
|
|
|
dest: "{{ gitea_install_path }}"
|
|
|
|
mode: 0775
|
|
|
|
tags:
|
|
|
|
- install
|
|
|
|
when: internet_available
|
|
|
|
|
2018-10-18 07:36:00 +00:00
|
|
|
- name: Download Gitea GPG signature
|
|
|
|
get_url:
|
|
|
|
url: "{{ gitea_integrity_url }}"
|
2018-10-18 16:35:16 +00:00
|
|
|
dest: "{{ gitea_checksum_path }}"
|
2018-10-18 07:36:00 +00:00
|
|
|
tags:
|
|
|
|
- install
|
|
|
|
when: internet_available
|
|
|
|
|
|
|
|
- name: Verify Gitea binary with GPG signature
|
|
|
|
shell: |
|
|
|
|
gpg --keyserver pgp.mit.edu --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
|
2018-10-18 16:35:16 +00:00
|
|
|
gpg --verify {{ gitea_checksum_path }} {{ gitea_install_path }}
|
2018-10-18 07:36:00 +00:00
|
|
|
tags:
|
|
|
|
- install
|
2018-10-18 16:35:16 +00:00
|
|
|
- verify
|
2018-10-18 07:36:00 +00:00
|
|
|
|
2018-10-18 16:52:51 +00:00
|
|
|
- name: Link Gitea
|
|
|
|
file:
|
|
|
|
src: "{{ gitea_install_path }}"
|
|
|
|
dest: "{{ gitea_link_path }}"
|
|
|
|
owner: gitea
|
|
|
|
group: gitea
|
|
|
|
state: link
|
|
|
|
|
2018-10-18 07:26:39 +00:00
|
|
|
- name: Create 'gitea' service
|
|
|
|
template:
|
|
|
|
src: gitea.service.j2
|
|
|
|
dest: "/etc/systemd/system/gitea.service"
|
|
|
|
tags:
|
|
|
|
- systemd
|
|
|
|
|
|
|
|
- name: Enable 'gitea' service
|
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
|
|
|
name: gitea
|
|
|
|
enabled: yes
|
|
|
|
state: restarted
|
|
|
|
when: gitea_enabled
|
|
|
|
|
|
|
|
- name: Disable 'gitea' service
|
|
|
|
systemd:
|
|
|
|
name: gitea
|
|
|
|
enabled: no
|
|
|
|
state: stopped
|
|
|
|
when: not gitea_enabled
|
|
|
|
|
|
|
|
- name: Copy gitea httpd conf file
|
|
|
|
template:
|
|
|
|
src: gitea.conf.j2
|
|
|
|
dest: "/etc/{{ apache_config_dir }}/gitea.conf"
|
|
|
|
|
|
|
|
- name: Enable httpd conf file if we are disabled (debuntu)
|
|
|
|
file:
|
|
|
|
src: /etc/{{ apache_config_dir }}/gitea.conf
|
|
|
|
dest: /etc/apache2/sites-enabled/gitea.conf
|
|
|
|
state: link
|
|
|
|
when: gitea_enabled and is_debuntu
|
|
|
|
|
|
|
|
- name: Remove httpd conf file if we are disabled (OS's other than debuntu)
|
|
|
|
file:
|
|
|
|
path: /etc/apache2/sites-enabled/gitea.conf
|
|
|
|
state: absent
|
|
|
|
when: not gitea_enabled and is_debuntu
|
|
|
|
|
|
|
|
- name: Restart Apache, so it picks up the new aliases
|
|
|
|
service:
|
|
|
|
name: "{{ apache_service }}"
|
|
|
|
state: restarted
|
|
|
|
|
|
|
|
- name: Add 'gitea' to list of services at /etc/iiab/iiab.ini
|
|
|
|
ini_file:
|
|
|
|
dest: "{{ service_filelist }}"
|
|
|
|
section: gitea
|
|
|
|
option: "{{ item.option }}"
|
|
|
|
value: "{{ item.value }}"
|
|
|
|
with_items:
|
|
|
|
- option: name
|
|
|
|
value: gitea
|
|
|
|
- option: description
|
|
|
|
value: '"gitea is an email service."'
|
|
|
|
- option: gitea_run_directory
|
|
|
|
value: "{{ gitea_run_directory }}"
|
|
|
|
- option: gitea_url
|
|
|
|
value: "{{ gitea_url }}"
|
|
|
|
- option: gitea_full_url
|
|
|
|
value: "{{ gitea_full_url }}"
|
|
|
|
- option: gitea_enabled
|
|
|
|
value: "{{ gitea_enabled }}"
|