1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/gitea/tasks/enable.yml

70 lines
1.9 KiB
YAML
Raw Normal View History

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