By Ansible to build a Web services architecture.
Inventory document reads as follows:
[proxy]
192.168.40.254
[app]
192.168.40.243
[nosql]
192.168.40.252
[db]
192.168.40.252
(1) First, using ansible installation Nginx.
ansible proxy -m yum -a "name=nginx state=present"
Use yum module mounted on the package CentOS. With particular attention to the meaning of state.
From a network installation:
ansible proxy -m yum -a "name=http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6.0.el6.ngx.noarch.rpm state=present"
From the local installation:
ansible proxy -m yum -a "name=/usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm state=present"
(2) then deploy apps server.
=== nginx and php
ansible app -m yum -a "name=nginx state=present"
ansible app -m yum -a "name=php state=present"
=== django
ansible app -m yum -a "name=MySQL-python state=present"
ansible app -m yum -a "name=python-setuptools state=present"
ansible app -m pip -a "name=django state=present"
ansible app -m command -a "python -c 'import django; print django.get_version()' "