--- - name: Configure webserver with nginx hosts: webservers become: true vars: tasks: - name: Ensure nginx is installed package: name: nginx update_cache: true - name: Copy nginx config file copy: src: nginx.conf dest: /etc/nginx/sites-available/default - name: Enable Configuration file: src: /etc/nginx/sites-available/default dest: /etc/nginx/sites-enabled/default state: link - name: Copy index.html template: src: index.html.j2 dest: /usr/share/nginx/html/index.html - name: Restart nginx service: name: nginx state: restarted ...