vm-ansible/roles/webserver/tasks/main.yaml
Torma Kristóf 590f20de67
Some checks failed
continuous-integration/drone/push Build is failing
restart services
2022-05-29 15:24:02 +02:00

61 lines
1.1 KiB
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: "Install nginx exporter"
apt:
update_cache: yes
state: present
name:
- prometheus-nginx-exporter
- name: Allow nginx exporter via ufw
community.general.ufw:
rule: allow
port: 9113
proto: tcp
src: 192.168.69.0/24
- name: Enable and restart exporter daemon
service:
name: prometheus-nginx-exporter
state: restarted
enabled: yes
- name: Allow https port via ufw
community.general.ufw:
rule: allow
port: https
...