--- - name: "nginx | apt update cache" apt: update_cache: yes cache_valid_time: 86400 #One day tags: - nginx - nginx_install - name: "nginx | install packages" apt: name: "{{ item }}" update_cache: true state: present with_items: - nginx-common - nginx-full register: is_nginx tags: - nginx - nginx_install - name: "nginx | remove default vhost" file: path: "/etc/nginx/sites-enabled/default" state: absent tags: - nginx - nginx_install