--- - hosts: all pre_tasks: - apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present with_items: - php5-fpm - lineinfile: dest=/etc/hosts line="127.0.2.2 {{ nginx_vhosts|map(attribute='name')| join(' ') }}" vars: nginx_php: true nginx_php_sockets: - unix_socket: "/var/run/php5-fpm.sock" nginx_vhosts: - name: 'test.local' aliases: - test-alias.local - test2-alias.local template: 'static' ssl: use: false - name: 'test-php.local' template: 'wordpress' ssl: use: false roles: - ../../ post_tasks: - name: -- Add PHP file -- copy: dest=/var/www/test-php.local/public/index.php content="