2015-07-15 17:14:39 +07:00
|
|
|
---
|
|
|
|
|
|
|
|
- hosts: all
|
2015-07-15 21:26:27 +07:00
|
|
|
pre_tasks:
|
2015-07-15 22:24:50 +07:00
|
|
|
- apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present
|
|
|
|
with_items:
|
|
|
|
- php5-fpm
|
2015-07-30 18:02:21 +07:00
|
|
|
- lineinfile: >
|
|
|
|
dest=/etc/hosts
|
|
|
|
line="127.0.2.2 {% for name in nginx_vhosts|map(attribute='name') %}{{ name | join(' ') }} {% endfor %}"
|
2015-07-15 20:18:51 +07:00
|
|
|
vars:
|
2015-07-15 21:26:27 +07:00
|
|
|
nginx_php: true
|
2015-07-16 21:24:44 +07:00
|
|
|
nginx_php_sockets:
|
2015-07-16 16:44:54 +07:00
|
|
|
- unix_socket: "/var/run/php5-fpm.sock"
|
2015-07-15 20:18:51 +07:00
|
|
|
nginx_vhosts:
|
2015-07-30 18:02:21 +07:00
|
|
|
- name:
|
|
|
|
- 'test.local'
|
|
|
|
- 'test-alias.local'
|
|
|
|
- 'test2-alias.local'
|
|
|
|
template: '_base'
|
|
|
|
- name:
|
|
|
|
- 'test-php.local'
|
|
|
|
template: '_php'
|
2015-07-15 17:14:39 +07:00
|
|
|
roles:
|
|
|
|
- ../../
|
2015-07-15 22:24:50 +07:00
|
|
|
post_tasks:
|
2015-07-16 21:24:44 +07:00
|
|
|
- name: -- Add PHP file --
|
2015-07-30 18:02:21 +07:00
|
|
|
copy: dest="{{ nginx_root }}/test-php.local/public/index.php" content="<?php phpinfo();"
|
2015-07-16 21:24:44 +07:00
|
|
|
- name: -- Add HTML file --
|
2015-07-30 18:02:21 +07:00
|
|
|
copy: dest="{{ nginx_root }}/test.local/public/index.html" content="Index HTML test OK\n"
|
2015-07-15 22:24:50 +07:00
|
|
|
- name: -- VERIFY VHOSTS --
|
2015-07-30 18:02:21 +07:00
|
|
|
get_url: dest="/tmp/ansible_{{ item.name[0] }}.txt" url="http://{{ item.name[0] }}" validate_certs=no
|
2015-07-15 22:24:50 +07:00
|
|
|
with_items: nginx_vhosts
|
|
|
|
changed_when: false
|
|
|
|
|