2015-07-23 21:35:25 +07:00
|
|
|
---
|
|
|
|
|
|
|
|
- hosts: all
|
2015-07-23 22:10:15 +07:00
|
|
|
vars:
|
|
|
|
vhost: 'test.local'
|
|
|
|
pre_tasks:
|
|
|
|
- name: APT | Install nginx
|
|
|
|
apt: pkg=nginx state=present update_cache=yes cache_valid_time=3600
|
|
|
|
- name: LINEINFILE | Force vhost in /etc/hosts
|
|
|
|
lineinfile: dest=/etc/hosts line='127.0.0.1 {{ vhost }}'
|
|
|
|
- name: COPY | Vhost
|
|
|
|
copy: >
|
|
|
|
dest=/etc/nginx/sites-enabled/{{ vhost }}
|
|
|
|
content='server { server_name {{ vhost }}; root /var/www; location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; } }'
|
|
|
|
notify: reload nginx
|
|
|
|
handlers:
|
|
|
|
- name: reload nginx
|
|
|
|
service: name=nginx state=reloaded
|
2015-07-23 21:35:25 +07:00
|
|
|
roles:
|
|
|
|
- ../../
|
2015-07-23 22:10:15 +07:00
|
|
|
post_tasks:
|
|
|
|
- name: COMMAND | Test php-cli
|
|
|
|
command: php -i
|
|
|
|
changed_when: false
|
|
|
|
- name: FILE | Create /var/www
|
2015-07-23 23:10:17 +07:00
|
|
|
file: dest=/var/www state=directory
|
2015-07-23 22:10:15 +07:00
|
|
|
- name: COPY | Add phpinfo
|
|
|
|
copy: dest=/var/www/phpinfo.php content='<?php phpinfo();'
|
|
|
|
- name: COMMAND | Check vhost
|
|
|
|
command: curl -v http://{{ vhost }}/phpinfo.php
|
|
|
|
changed_when: false
|