--- - name: Ensure Apache HTTP is Not Installed apt: name=apache2 state=absent - name: Install nginx apt: name=nginx state=present - name: Create default nginx content directory file: path=/srv/http/default/www state=directory owner=www-data group=www-data mode=0775 recurse=yes - name: Setup default nginx pages copy: src: "{{item.src}}" dest: "/srv/http/default/www/{{item.dest}}" owner: www-data group: www-data force: no with_items: - {src: "{{ nginx_default_404 }}", dest: "404.html"} - {src: "{{ nginx_default_50x }}", dest: "50x.html"} - {src: "{{ nginx_default_favicon }}", dest: "favicon.png"} - {src: "{{ nginx_default_index }}", dest: "index.html"} - name: Copy generic (default) nginx site configuration template: src=etc_nginx_sites-available_default.j2 dest=/etc/nginx/sites-available/default - name: Create nginx symlink for default file: state=link src=/etc/nginx/sites-available/default dest=/etc/nginx/sites-enabled/default notify: nginx restart # reload not sufficient?