1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Add play for downloading Gitea binary

- Convert ansible_architecture variable to filename suffix
This commit is contained in:
Aidan Fitzgerald 2018-10-18 03:26:39 -04:00
parent a66d4ed636
commit e351a1c7c1
2 changed files with 83 additions and 0 deletions

View file

@ -6,6 +6,16 @@
gitea_version: "1.6"
gitea_install_path: "/usr/local/bin/gitea"
iset_suffixes:
i386: "386"
x86_64: "amd64"
armv6l: "arm-6"
armv7l: "arm-7"
gitea_iset_suffix: "{{ iset_suffixes[ansible_architecture | default("unknown architecture")] }}"
gitea_download_url: "https://dl.gitea.io/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_iset_suffix }}"
# Information needed to run Gitea
gitea_user: gitea
gitea_run_directory: /var/lib/gitea

View file

@ -0,0 +1,73 @@
- name: Download Gitea binary
get_url:
url: "{{ gitea_download_url }}"
dest: "{{ gitea_install_path }}"
mode: 0775
tags:
- install
when: internet_available
- 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 }}"