1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00
iiab/roles/gitea/tasks/enable.yml

73 lines
1.7 KiB
YAML

- name: Enable 'gitea' service
systemd:
daemon_reload: yes
name: gitea
enabled: yes
state: restarted
when: gitea_enabled | bool
- name: Disable 'gitea' service
systemd:
daemon_reload: yes
name: gitea
enabled: no
state: stopped
when: not gitea_enabled
# Configure HTTPD
- name: Copy gitea httpd conf file
template:
src: gitea.conf.j2
dest: "/etc/{{ apache_config_dir }}/gitea.conf"
- name: Enable httpd conf file (apache)
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: Remove apache httpd conf file (OS's other than debuntu)
file:
path: /etc/apache2/sites-enabled/gitea.conf
state: absent
when: not gitea_enabled or nginx_enabled
- name: Remove nginx httpd conf file
file:
path: "{{ nginx_config_dir }}/gitea-nginx.conf"
state: absent
when: not gitea_enabled
- name: Enable nginx httpd conf file
template:
src: gitea-nginx.conf.j2
dest: "{{ nginx_config_dir }}/gitea-nginx.conf"
when: gitea_enabled and nginx_enabled
- name: Restart nginx
systemd:
name: nginx
daemon_reload: yes
state: restarted
# 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 }}"