--- - 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: Copy default nginx config ansible.builtin.copy: src: prometheus-nginx-exporter dest: /etc/default/prometheus-nginx-exporter owner: root group: root mode: '0644' - 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 src: 192.168.69.0/24 ...