vm-ansible/roles/webserver/tasks/main.yaml
2022-04-16 20:01:29 +02:00

41 lines
713 B
YAML

---
- name: "Install Nginx via apt"
apt:
update_cache: yes
state: present
name:
- nginx
- name: Copy default nginx config
ansible.builtin.copy:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: '0644'
- name: Enable and restart nginx daemon
service:
name: nginx
state: restarted
enabled: yes
- name: "Generate nginx configuration"
ansible.builtin.template:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: '0644'
- name: Reload nginx daemon
service:
name: nginx
state: reloaded
- name: Allow https port via ufw
community.general.ufw:
rule: allow
port: https
...