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
2019-11-28 06:16:11 -06:00

75 lines
1.8 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 is_debuntu
- 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: /etc/nginx/conf.d/gitea-nginx.conf
state: absent
when: not gitea_enabled
- name: Enable nginx httpd conf file
template:
src: gitea-nginx.conf.j2
dest: /etc/nginx/conf.d/gitea-nginx.conf
when: gitea_enabled and nginx_enabled
- name: >-
Restart Apache ({{ apache_service }}) to {% if gitea_enabled %}enable{%
else %}disable{% endif %} http://box/gitea
systemd:
name: "{{ apache_service }}"
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 }}"