31 lines
889 B
YAML
31 lines
889 B
YAML
---
|
|
|
|
- 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
|
|
|