From 61186b3e040a821c5a16d4c85c6ba42793df6636 Mon Sep 17 00:00:00 2001 From: bennojoy Date: Tue, 12 Mar 2013 21:45:36 +0530 Subject: [PATCH] changes --- README.md | 2 +- lamp_haproxy/README.md | 32 ++++++++++-------------- lamp_haproxy/roles/common/tasks/main.yml | 2 +- lamp_haproxy/site.yml | 6 ++--- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 36bc748..7977315 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,5 @@ Ansible Examples ---------------- -This repository contains examples and best practises for building Ansible Playbooks. +This repository contains examples and best practices for building Ansible Playbooks. diff --git a/lamp_haproxy/README.md b/lamp_haproxy/README.md index df2a323..4a73b07 100644 --- a/lamp_haproxy/README.md +++ b/lamp_haproxy/README.md @@ -1,43 +1,37 @@ -Lamp Stack + LoadBalancer(haproxy) + add/remove nodes from cluster + Serial Rolling update of webserserver +Lamp Stack + load balancer(haproxy) + add/remove nodes from cluster + Serial Rolling update of webserserver ---------------------------------------------------------------------------------------------------------- This example is an extension of the simple lamp deployment, In this example we deploy a lampstack with a LoadBalancer in front. -This also has the capablity to add/remove nodes from the deployment. It also includes examples to do a rolling update of a stack +This also has the capability to add/remove nodes from the deployment. It also includes examples to do a rolling update of a stack without affecting the service. -###Setup Entire Site. +***Setup Entire Site. Firstly we setup the entire stack, configure the 'hosts' inventory file to include the names of your hosts on which the stack would be deployed. - [webservers] web3 web2 [dbservers] web3 [lbservers] - web2 - -After which we execute the following command to deploy the whole site. - + lbserver +After which we execute the following command to deploy the site. ansible-playbook -i hosts site.yml -The deployment can be verified by accessing the webpage." lynx http://:8888. multiple access should land you up in diffrent webservers. +The deployment can be verified by accessing the webpage." lynx http://:8888. multiple access should land you up in different webservers. -###Remove a node from the cluster. +***Remove a node from the cluster. Removal of a node from the cluster would be as simple as executing the following command: + ansible-playbook -i hosts playbooks/remove_webservers.yml --limit=web2 - ansible-playbook -i hosts roles/remove_webservers.yml --limit=web2 - -###Adding a node to the cluster. -Adding a node to the cluster can be done by executing the following command: - - ansible-playbook -i hosts roles/add_webservers.yml --limit=web2 +***Adding a node to the cluster. +Adding a node to the cluster can be done by executing the following command + ansible-playbook -i hosts playbooks/add_webservers.yml --limit=web2 -###Rolling update of the entire site or a single hosts +***Rolling update of the entire site or a single hosts Rolling updates are the preffered way to do an update as this wont affect the end users, In this example the hosts are updated in serial fashion, which means that only one server would be updated at one time, this behaviour can be changed by setting the 'serial' keyword in webservers.yml file. Once the code has been updated in the repository which can be defined in the group_vars/all file, execute the following command: - - ansible-playbook -i hosts roles/rolling_update.yml + ansible-playbook -i hosts playbooks/rolling_update.yml diff --git a/lamp_haproxy/roles/common/tasks/main.yml b/lamp_haproxy/roles/common/tasks/main.yml index a0d7875..3e1cfec 100644 --- a/lamp_haproxy/roles/common/tasks/main.yml +++ b/lamp_haproxy/roles/common/tasks/main.yml @@ -6,7 +6,7 @@ tags: ntp - name: Configure ntp file - template: src=common/templates/ntp.conf.j2 dest=/etc/ntp.conf + template: src=../roles/common/templates/ntp.conf.j2 dest=/etc/ntp.conf tags: ntp notify: restart ntp diff --git a/lamp_haproxy/site.yml b/lamp_haproxy/site.yml index 6bfb3d4..bf4eed8 100644 --- a/lamp_haproxy/site.yml +++ b/lamp_haproxy/site.yml @@ -1,6 +1,6 @@ --- #This Playbook deploys the whole application stack in this site. -- include: roles/db.yml -- include: roles/web.yml -- include: roles/haproxy.yml +- include: playbooks/db.yml +- include: playbooks/web.yml +- include: playbooks/haproxy.yml