zaterdag 11 april 2015

Setup a cloud environment with Puppet and Oscar.

In this blog I will explain how to create a fully reproducible test setup for Puppet. All the tools in this tutorial are free to use. I'm using puppet 3.7 enterprise. We are going to boot up 3 nodes. 1 Puppet master and 2 agents. After that you can add up to 8 agents.

Step 1. Download and install.

For Linux users!! Don't use yum or apt-get you will get an old version of vagrant. Download and install the software from their website. Download and install this three software packages.

Step 2. Install Oscar

Make a folder somewhere on your file system. This folder will contain the complete puppet installation.

mkdir Documents/puppet/oscar1 
cd Documents/puppet/oscar1 
vagrant plugin install oscar 
vagrant oscar init

The folder is initialised, if we run three you can see that oscar placed a Vagrantfile and a config folder with 4 config files in it.
.
├── Vagrantfile
└── config
    ├── boxes.yaml
    ├── pe_build.yaml
    ├── roles.yaml

    └── vms.yaml

vagrant oscar init-vms \ --master master=centos-64-x64-vbox4210-nocm \ --agent first=centos-64-x64-vbox4210-nocm \
--agent second=centos-64-x64-vbox4210-nocm

If you check the file config/vms.yaml in your oscar folder. You should see something like this. Three machines with CentOs 6 box. One master and two agents. Its important to use this particular version of CentOs. Later on we need to download the Puppet binaries for this version of the OS.
---
vms:
- name: master
  box: centos-64-x64-vbox4210-nocm
  roles:
  - pe-puppet-master
- name: first
  box: centos-64-x64-vbox4210-nocm
  roles:
  - pe-puppet-agent
- name: second
  box: centos-64-x64-vbox4210-nocm
  roles:

  - pe-puppet-agent

Step 3. Tweak Oscar


Oscar will not work out of the box. It needs some tweaks. 


Add Puppet binaries.

The version of your Puppet binaries depends on the OS there installed on. We need one for CentOs.
Install the vagrant-pe_build plugin to 'add' versions of Puppet to Oscar.

vagrant plugin install vagrant-pe_build

And you need to download the correct version of puppet enterprise from the website. Go to the puppet website and click "get started" > "try puppet enterprise" > "free trail" > Fill out the form.

Select from the drop down menu.
Operating System: EL
Version: 6
Architecture: x86_64
Download


After the download has completed. Add the puppet binaries to oscar.

vagrant pe-build copy ~/Downloads/puppet-enterprise-3.7.2-el-6-x86_64.tar.gz

Check with vagrant pe-build list to see if your version of puppet was added to Vagrant.

Change the config files.

Assure yourself that you are in the correct folder.
cd ~/Documents/puppet/oscar1

pe_build.yaml

Check the puppet version specified in pe-build.yaml file.

vi config/pe_build.yaml
---
pe_build:

  version: 3.7.2


roles.yaml

Add firewall rules and adjust memory settings. A PE 3.7  master needs at least 4GB of ram to run. Default Oscar will set 1GB ram to the master. This is nog enough and your installation will fail. Copy and paste the roles.yaml file from my github to your local file. 

vi config/roles.yaml



Step 4. Launch your 3 puppet managed nodes.

Assure yourself that you are in the correct folder.
cd ~/Documents/puppet/oscar1
Launch Puppet
vagrant up
Wait 10 minutes.


Step 5 Log in to the puppet console.

Lookup the ip address of the puppet master
vagrant ssh master
ifconfig
eth01 ipaddress.

Open a browser and point to https://<ip_address_master>

Log in with
user: admin
password: puppetlabs
















Geen opmerkingen:

Een reactie posten