--- - hosts: test become: yes vars: server_name: 'firmware.freifunk.lu ' document_root: /var/www/firmware.freifunk.lu tasks: - name: Update apt cache and install Nginx apt: name: nginx state: latest update_cache: yes # Create directory firmware.freifunk.lu - name: Create the directory firmware.freifunk.lu in /var/www if it does not exist ansible.builtin.file: path: /var/www/firmware.freifunk.lu state: directory mode: '0755' - name: Apply Nginx template template: src: /etc/ansible/playbooks/files/firmware.conf.j2 dest: /etc/nginx/sites-available/firmware.freifunk.lu notify: Restart Nginx - name: Enable new site file: src: /etc/nginx/sites-available/firmware.freifunk.lu dest: /etc/nginx/sites-enabled/firmware.freifunk.lu state: link notify: Restart Nginx handlers: - name: Restart Nginx service: name: nginx state: restarted