feat (role): adds nginx installation role, tests are required

This commit is contained in:
2026-09-06 19:50:08 +05:00
parent cc68a1f863
commit 32b6a49bc8
19 changed files with 297 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
---
- name: Install NGINX on apt-based systems
become: true
ansible.builtin.apt:
name: nginx
state: present
update_cache: true
- name: Enable systemd service
ansible.builtin.service:
name: nginx
state: started
enabled: true
# We don't want to activate this config right away, so push it after service started
- name: Configure NGINX, by pushing the config directory
become: true
ansible.builtin.copy:
src: "{{ role_path }}/files/nginx"
dst: "/etc/nginx"
- name: Install custom error pages
become: true
ansible.builtin.shell: |
mkdir -p /srv/http/default
git clone https://github.com/denysvitali/nginx-error-pages /srv/http/default
ln -s /srv/http/default/snippets/error_pages.conf /etc/nginx/snippets/error_pages.conf
ln -s /srv/http/default/snippets/error_pages_content.conf /etc/nginx/snippets/error_pages_content.conf