--- - name: Install and configure Nginx hosts: targets become: true tasks: - name: Install Nginx ansible.builtin.apt: name: nginx state: present update_cache: true - name: Ensure Nginx is running ansible.builtin.service: name: nginx state: started enabled: true - name: Deploy index page ansible.builtin.template: src: ../templates/index.html.j2 dest: /var/www/html/index.html owner: root group: root mode: '0644'