26 lines
617 B
YAML
26 lines
617 B
YAML
---
|
|
- name: "Install Nginx"
|
|
ansible.builtin.apt:
|
|
name: nginx
|
|
state: present
|
|
|
|
- name: "Ensure Nginx is enabled and started"
|
|
ansible.builtin.service:
|
|
name: nginx
|
|
state: started
|
|
enabled: yes
|
|
|
|
- name: "Remove the default Nginx site to prevent conflicts"
|
|
ansible.builtin.file:
|
|
path: /etc/nginx/sites-enabled/default
|
|
state: absent
|
|
notify: Reload Nginx
|
|
|
|
- name: "Create a default catch-all server block"
|
|
ansible.builtin.copy:
|
|
src: 00-default-catch-all.conf
|
|
dest: /etc/nginx/conf.d/00-default-catch-all.conf
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
notify: Reload Nginx |