34 lines
981 B
YAML
34 lines
981 B
YAML
---
|
|
# Nginx configuration for Gitea tasks
|
|
- name: Create Nginx configuration for {{ gitea_domain }}
|
|
template:
|
|
src: gitea-nginx-site.conf.j2
|
|
dest: "{{ nginx_config_path }}/{{ gitea_domain }}"
|
|
|
|
- name: Verify Nginx configuration file exists
|
|
stat:
|
|
path: "{{ nginx_config_path }}/{{ gitea_domain }}"
|
|
register: gitea_nginx_config_stat
|
|
|
|
- name: Enable Gitea Nginx site
|
|
file:
|
|
src: "{{ nginx_config_path }}/{{ gitea_domain }}"
|
|
dest: "/etc/nginx/sites-enabled/{{ gitea_domain }}"
|
|
state: link
|
|
when: gitea_nginx_config_stat.stat.exists
|
|
|
|
- name: Test Nginx configuration
|
|
command: nginx -t
|
|
register: nginx_test
|
|
changed_when: false
|
|
|
|
- name: Display Nginx test result
|
|
debug:
|
|
msg: "{{ nginx_test.stdout }}"
|
|
|
|
- name: Restart Nginx if configuration changed
|
|
systemd:
|
|
name: nginx
|
|
state: restarted
|
|
when: gitea_nginx_config_stat.stat.exists
|