I wrote a post awhile back about using node.js, ansible, and python to do my apache cloudstack installation. Ansible is great but I basically used python to make using ansible a bit more easy since there are a few things with any ansible setup which needs to be remembered. One of those things is the ansible hosts that gets used. This could be the default file found in /etc/ansible/hosts or any file of your choose when using the “-i” option. Then there are the variables which have to be dealt with. I happen to use a file in this case because it’s easy to edit pragmatically. You could edit both of these files manually but mistakes can be made and you have to remember what to edit. As I get older this becomes harder and harder. Plus I get the added bonus of being able to hand over a solution that someone else can run without the worry of them screwing it up. Well, at least the screw up potential is low. Enough talking about it, let’s get into my process.
First thing I do is install the dependencies for the main deployment system with ansible and node.js. This only needs to be done once in each environment as long as the main system can reach the remote servers. I’m doing all my installations on CentOS 6.5 and that includes the main deployment system. I’ll be using VMs during this exercise to make the demonstrations easy for me. You can install ansible and node.js on other platforms but I will not show it but there are great resources out there that can help you out. Here is what my example environment looks like.
6x CentOS 6.5 linux VMs using VMware Fusion 6.0.2 and they are all on the same network and accessible via SSH.
- ansible - used to install ansible and node.js
- cldstkdbsrv01 - primary mysql server
- cldstkdbsrv02 - replica mysql server
- cldstkwebsrv01 - cloudstack management server
- cldstkwebsrv02 - cloudstack management server
- cldstkkvm01 - cloudstack agent - KVM host
Step by Step
- Because I’m using virtualization I must expose the cpu features needed for KVM. This can be found in the Settings > Processors & Memory section in VMware Fusion. If I had physical hardware I’d need to make sure my processors were compatible.
- Log into the ansible server (main deployment server)
- Then I install ansible but first I’ll have to configure EPEL. This can be done by running this command
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm.
- Now that EPEL is installed and configured, run
yum install ansible -y
- Now I install node.js, run
yum install npm -y
- I then copy over the cldstk-deploy folder using scp, run
scp -r cldstk-deploy_3 [email protected]:/tmp/cldstk-deploy_3/
- Test that ansible is installed and working, run
- Test that node.js is installed and working, run
- Now I update the /etc/hosts file with the targeted systems because I do not have DNS configured.
- Let’s run cldstk-deploy, run
python start.py. This is a python script that except inputs that are needed for the deployment and ansible-playbooks used on the backend.
- Do not “Start the installation”! So type ‘n’ when asked. I want to something first that you’ll see in a couple of steps.
- This created and populated the ‘ansible/hosts’ and ‘ansible/vars_file.yml’ files with what was entered in the prompts.
- Lets test that ansible can connect to the systems, run
ansible all -i ansible/hosts -m setup -k.
- The first time this is run it will ask “Are you sure you want to continue connecting (yes/no)?”, just type ‘yes’.
- You can run another test to valid which systems are in the ansible hosts file, run
ansible all -i ansible/hosts -m setup -k | grep ansible_hostname
- Now we can run the install with
python start.py -i
- This will start the node.js express server and run the ansible-playbooks.
This process runs through a few ansible playbooks. Here’s a high level process flow in order:
- create-cloudstack-repo.yml # basically edited with the main deployment servers ip address for the cloudstack package repository
- hostfileupdate.yml # used to add all the systems the /etc/hosts file on each system
- mysql-server-install.yml # used to install mysql server
- cloudstack-mgmt_deploy.yml # used to install Cloudstack Management servers
- mysql-replication-setup.yml # used to install and configure replication for mysql server for redundancy
- cloudstack-agent_deploy.yml # used to install Cloudstack Agent servers
- cldstk-install-sys-tmpl.yml # preseeds the system templates
When this process completes all the components are installed and configured so you can login to the Cloudstack Management server. It currently does not add or setup the cloudstack agent servers into a cluster in a Cloudstack zone so this is a manual process for now as there are to many variables to contend with.
Check out the video showing all the things outlined above.