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

83 lines
2.2 KiB
YAML

- name: Enable 'gitea' systemd service
systemd:
daemon_reload: yes
name: gitea
enabled: yes
state: restarted
when: gitea_enabled | bool
- name: Disable 'gitea' systemd service
systemd:
daemon_reload: yes
name: gitea
enabled: no
state: stopped
when: not gitea_enabled
# Configure Apache
- name: Remove softlink /etc/apache2/sites-enabled/gitea.conf
file:
path: /etc/apache2/sites-enabled/gitea.conf
state: absent
when: not gitea_enabled or nginx_enabled
- name: 'Install from template: /etc/{{ apache_config_dir }}/gitea.conf'
template:
src: gitea.conf.j2
dest: "/etc/{{ apache_config_dir }}/gitea.conf"
when: not nginx_enabled
- name: Enable softlink /etc/apache2/sites-enabled/gitea.conf -> /etc/{{ apache_config_dir }}/gitea.conf
file:
src: /etc/{{ apache_config_dir }}/gitea.conf
dest: /etc/apache2/sites-enabled/gitea.conf
state: link
when: gitea_enabled and not nginx_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # httpd or apache2
state: restarted
when: not nginx_enabled
# Configure NGINX
- name: Remove {{ nginx_config_dir }}/gitea-nginx.conf
file:
path: "{{ nginx_config_dir }}/gitea-nginx.conf"
state: absent
when: not gitea_enabled or not nginx_enabled
- name: 'Install from template: {{ nginx_config_dir }}/gitea-nginx.conf'
template:
src: gitea-nginx.conf.j2
dest: "{{ nginx_config_dir }}/gitea-nginx.conf"
when: gitea_enabled and nginx_enabled
- name: Restart nginx systemd service
systemd:
name: nginx
daemon_reload: yes
state: restarted
when: nginx_enabled | bool
# Add Gitea to registry
- name: Add 'gitea' to list of services at {{ iiab_ini_file }}
ini_file:
dest: "{{ iiab_ini_file }}"
section: gitea
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- option: name
value: gitea
- option: description
value: '"Gitea: 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 }}"