1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/gitea/tasks/enable.yml
2020-01-29 10:48:23 -05:00

69 lines
1.9 KiB
YAML

- name: Enable & Restart 'gitea' systemd service
systemd:
name: gitea
daemon_reload: yes
enabled: yes
state: restarted
when: gitea_enabled | bool
- name: Disable & Restart 'gitea' systemd service
systemd:
name: gitea
enabled: no
state: stopped
when: not gitea_enabled
# Apache
- name: Enable http://box{{ gitea_url }} via Apache # i.e. http://box/gitea
command: a2ensite gitea.conf
when: apache_install and gitea_enabled
- name: Disable http://box{{ gitea_url }} via Apache
command: a2dissite gitea.conf
when: apache_install and not gitea_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted
when: apache_enabled | bool
# NGINX
- name: Enable http://box{{ gitea_url }} via NGINX, by installing {{ nginx_conf_dir }}/gitea-nginx.conf from template
template:
src: gitea-nginx.conf.j2
dest: "{{ nginx_conf_dir }}/gitea-nginx.conf"
when: nginx_install and gitea_enabled
- name: Disable http://box{{ gitea_url }} via NGINX, by removing {{ nginx_conf_dir }}/gitea-nginx.conf
file:
path: "{{ nginx_conf_dir }}/gitea-nginx.conf"
state: absent
when: nginx_install and not gitea_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
state: restarted
when: nginx_enabled | bool
- name: Add 'gitea' to list of services at {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
section: gitea
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: name
value: Gitea
- option: description
value: '"Gitea is like GitHub for more offline communities: Git with a cup of tea"'
- option: gitea_run_directory
value: "{{ gitea_run_directory }}"
- option: gitea_url
value: "{{ gitea_url }}"
- option: gitea_enabled
value: "{{ gitea_enabled }}"