initial commit

This commit is contained in:
Peter Meier
2025-10-16 22:54:40 +02:00
parent d80ca5979e
commit 5e6faaffcf
23 changed files with 1608 additions and 1 deletions

View File

@@ -0,0 +1,56 @@
---
# Nginx installation and configuration tasks
- name: Install Nginx
apt:
name: nginx
state: present
update_cache: yes
- name: Start and enable Nginx service
systemd:
name: nginx
state: started
enabled: yes
- name: Remove default Nginx site
file:
path: /etc/nginx/sites-enabled/default
state: absent
- name: Create SSL directory
file:
path: "{{ nginx_ssl_path }}"
state: directory
mode: '0755'
- name: Create Nginx configuration for {{ trillium_domain }}
template:
src: nginx-site.conf.j2
dest: "{{ nginx_config_path }}/{{ trillium_domain }}"
- name: Verify Nginx configuration file exists
stat:
path: "{{ nginx_config_path }}/{{ trillium_domain }}"
register: nginx_config_stat
- name: Enable Nginx site
file:
src: "{{ nginx_config_path }}/{{ trillium_domain }}"
dest: "/etc/nginx/sites-enabled/{{ trillium_domain }}"
state: link
when: 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: nginx_test.stdout is defined