Tag: install

Installing Foreman 1.0.1

Just recently the Foreman project released the latest version, 1.0.1. If you are following our [previous guide to install 0.4.2](http://www.cloudcomp.ch/2012/06/automating-the-icclab-part-one/) then you should also follow this.

# Installing & Configuring Foreman
You should setup your virtual machine exactly as we did in the previous guide, install puppet and checkout the foreman-installer modules from github. There is a small number of issues with the installer but we’ll easily walk you through them!

To check things out quickly, you can [download a VM (OVA) that has Foreman 1.0.1](http://www.cloudcomp.ch/wp-content/uploads/2012/09/Foreman1.01.ova) preconfigured. The username/password is `root` and `root`. This also includes puppet modules to deploy OpenStack compute and controller nodes.

> Side note: the puppetlabs repository has changed. Make sure to:
> `wget http://apt.puppetlabs.com/puppetlabs-release-stable.deb`

Ensure that the foreman-proxy is part of the bind group. If not add the user:

[gist id=3667157]

Configure your `foreman_proxy/manifests/params.pp as` before, ensuring to enable DHCP and DNS and for each of those setting the correct network settings (subnet etc)

Configure you `foreman/manifest/params.pp` as before. For us we disabled SSL. Very important here is that you set the `foreman_url` parameter to include the port number on which foreman listens (port 3000).

[gist id=3667152]

If it is not set then the scripts that tie puppet and foreman together will not work. This is a [known and reported issue](http://theforeman.org/issues/1855), which will be resolved.

Currently there is a bug in `foreman_proxy/manifests/proxydhcp.pp`. For now you need to manually set the DNS `nameserver` and TFTP `nextserver` parameters. This [bug has been reported](https://groups.google.com/d/topic/foreman-users/t1m8JeWVd7U/discussion) and will be resolved soon.

Finally you need to apply [this patch](https://github.com/theforeman/smart-proxy/commit/a402c71290f2d8205e60b876f2a40dfa9fefacda). Puppet in its most recent version changed the value of the return code from operations related to `puppetca`. This causes blocking issues with provisioning and deleting hosts with foreman. You can use this sed command if it suits you:

[gist id=3667151]

Once applied you should restart the foreman-proxy service

[gist id=3667147]

Note, if you start the foreman service and it halts with a stacktrace then you will have to reinitialise the database. This is a one-time operation.

[gist id=3667139]

Once these step have been complete, you can then configure Foreman itself (setting smart proxy, host groups etc).

When configuring these various aspects you should update the ‘Ubuntu default’ disk partition table configuration. Use the following to ensure a complete automatic install:

[gist id=3667133]

One of the issues that we’re dealing with currently is that rather than the puppetmaster’s hostname being placed in the relevant configuration files (e.g. `puppet.conf`), an IP address is inserted. This will not work as it will fail with SSL issues. The current work around is to create a ‘snippet’ in the Provisioning Templates section. With this snippet created then set the content of the config files in Provisioning Templates to (using `puppet.conf` as an examples):

[gist id=3667127]

Puppet and OpenStack: Part One

In this guide we’ll explain how you can setup a simple OpenStack all in one installation using puppet. In this guide we’ll be using a virtual machine to simulate the hardware. We’ll use the same network configration as was used [in the article on Foreman](http://www.cloudcomp.ch/2012/06/automating-the-icclab-part-one/). We’ll also be using Ubuntu 12.04.

By default, nameserver and domain settings are automatically managed by `resolvconf` (this is due to the primary adapter being managed by DHCP). As puppet relies on the fully qualified host name of nodes its installed on, you should, if not using other means, configure `resolvconf` so that it does not overwrite your domain and nameserver settings. To do this edit `/etc/resolvconf/resolv.conf.d/head` and place the following content:

[gist id=3029170]

Of course feel free to use what ever other values you like to use. Performing this configuration will ensure that resolvconf always generates settings with your values.

If you are not using your own managed DNS server then you should place IP-host aliases in your `/etc/hosts` file. Here’s the relevant file entries used in this article:

[gist id=3029172]

Once you have the virtual machine installed, it might help you if you take a snapshot of the it at this stage so that you can roll-back to a fresh state.

## Install Puppet

Execute the following:

[gist id=3029174]

## Configure Puppet
In order to deploy OpenStack, we will be using puppet in both agent and master mode.

### Agent Configuration
Configure puppet agent. Edit `/etc/puppet/puppet.conf` so that it the `[agent]` section has the set values of:

[gist id=3029176]

### Master Configuration
Configure puppet master. Edit `/etc/puppet/puppet.conf` so that it the `[master]` section has the set values of:

[gist id=3029177]

***Note*** that this particular configuration will change when we integrate with Foreman in the article describing Foreman, puppet and OpenStack integration.

## Select Puppet Modules

We’ll use the [official Puppetlabs OpenStack modules](https://github.com/puppetlabs/puppetlabs-openstack). Install the prerequisites and checkout the OpenStack modules from Github:

[gist id=3029179]

Once done you’ll need to follow the setup instructions (they’re repeated here for completeness):

[gist id=3029180]

After executing these steps, the rake script will have placed other required puppet modules in `/etc/puppet/modules/`

## Assign the OpenStack Role
We now have to tell puppet that the current VM is to run as a complete OpenStack instance. To do this copy the example `site.pp` file to `/etc/puppet/manifests/` and then edit so that:

1. the node definition for the VM reads as `node /controller.cloudcomplab.ch/ {`
2. `libvirt_type` is set to `qemu`
3. if you want further logging information to help you, then set `$verbose` to `true`
4. you might want to specify a floating (i.e. static) IP range. For this setup you can add and set `floating_range` to `’192.168.56.128/25’`

Once done, wait! This setup will run perfectly fine until you attempt to invoke the services of `nova-volume`. `nova-volume` is not fully setup as there is no LVM group (`nova-volumes`) setup. To set this up manually execute these steps as root:

1. `truncate -s 2052M /root/nova-vol-file`
2. Find the loop-back device associated with `nova-vol-fil`:

`losetup -f –show /root/nova-vol-file`

In this setup the value is `/dev/loop1`

3. Now, finally, create the LVM volume group:

`vgcreate nova-volumes /dev/loop1`

You may need to install the LVM tools: `apt-get -y install lvm2`

**Note** that this LVM mapping is reset on reboot.

Now that you have setup LVM and puppet to install OpenStack, do just that! Execute:

`puppet agent –no-daemonize –verbose`

You’ll see alot of output as puppet installs OpenStack but at the end of the process you will be able to access your OpenStack installation at `http://192.168.56.2`

## Using OpenStack
Now that you’ve seen the shiny UI of OpenStack you will have noticed that there are no VM images to run. To get a VM image into OpenStack do the following:

1. Import the authentication credentials into your shell (puppet was kind enough to create these for you)

`source /root/openrc`

2. Download a VM image, CirrOS in this case:

`wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img`

3. Import the CirrOS image into glance:

`glance add name=”CirrOS 0.3 VM Image” disk_format=qcow2 container_format=ovf < cirros-0.3.0-x86_64-disk.img`

4. Go back to your web user interface and you will see that there is now a VM image to instantiate and execute.

By the way, the puppetlabs OpenStack github repository [has some decent documentation](https://github.com/puppetlabs/puppetlabs-openstack).

# Next up
We've now successfully installed an "all-in-one" OpenStack using puppet. In the next article we'll look at expanding this to a multi-node scenario. Stay tuned!

Updated OCCI OpenStack Install Guide

Recently, the [OCCI implementation](http://www.github.com/dizz/nova) for [OpenStack](http://www.openstack.org) was made available by [work done by Intel Labs Europe](http://wiki.openstack.org/occi) as part of the [FI-ware project](http://www.fi-ware.eu). Some of the install instructions are now somewhat out of date. In this post we’ll outline the steps necessary to get the OCCI implementation up and running. This updated install guide is also now reflected on the [OpenStack OCCI wiki](http://wiki.openstack.org/occi). A big thanks goes out to Piotr Kasprzak at [GDWG](http://www.gwdg.de) for some of the updates!

# Steps

Create a fresh VM. Ubuntu 12.04 is a good baseline.

Get devstack:

[gist id=2917429]

Install some necessaries:

[gist id=2917431]

Fix the `prettytable` issue:

[gist id=2917434]

Edit `~/devstack/stackrc` so it checks out the OCCI branch of OpenStack:

[gist id=2917441]

Create/Edit `~/devstack/localrc` with the following content:

[gist id=2917445]

Now execute devstack:

[gist id=2917453]

You will be now asked for a number of service admin passwords. Once the devstack process has completed you should see the following:

[gist id=2917462]

Once the stack is running you can then issue the commands that are on the [OpenStack OCCI wiki page](http://wiki.openstack.org/occi).

A virtual machine with both OpenStack and OCCI can be [downloaded from here](http://www.cloudcomp.ch/wp-content/uploads/2012/06/OCCI-OS.ova). The user name and password is `occi` and `occi`. It is in an OVA export format and you can easily import into VirtualBox. In `~/devstack/localrc` the `OFFLINE` parameter is set to `True`. If you want to update the devstack installation change this to `False`.

## Potential Issues

1. If the OCCI API blocks and does not return a response then please check your `/etc/nova/api-paste.ini` configuration. Ensure that the `[filter:authtoken]` section has the correct `service_host` and `auth_host` values.