Worker Model OpenStack

CDS build using OpenStack infrastructure

Create OpenStack user

In OVH manager, in cloud section, click on the menu on the Servers>OpenStack item.

You will be able to create a worker model OpenStack user, enter description (name and password will be generated).

Add OpenStack worker model

We need to define an OpenStack worker model to have OpenStack hatchery booting workers.

We will create a model called testopenstack:

You need to configure:

Via UI (inside settings section –> worker models):

For example:

Worker Model UI OpenStack

Or via CLI with a yaml file:

$ cds worker model import my_worker_model.yml
name: testopenstack
type: openstack
description: "my worker model"
group: shared.infra
image: "Debian 7"
flavor: vps-ssd-1
pre_cmd: |
  set +e
  # Basic build binaries
  cd $HOME
  apt-get -y --force-yes update >> /tmp/user_data 2>&1
  apt-get -y --force-yes install curl git >> /tmp/user_data 2>&1
  apt-get -y --force-yes install binutils >> /tmp/user_data 2>&1
  # Docker installation (FOR DEBIAN)
  if [[ "x{{.FromWorkerImage}}" = "xtrue" ]]; then
    echo "$(date) - CDS_FROM_WORKER_IMAGE == true - no install docker required "
    # Install Docker
    apt-get install -y --force-yes apt-transport-https ca-certificates >> /tmp/user_data 2>&1
    apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
    mkdir -p /etc/apt/sources.list.d
    sh -c "echo deb debian-jessie main > /etc/apt/sources.list.d/docker.list"
    apt-get -y --force-yes update >> /tmp/user_data 2>&1
    apt-cache policy docker-engine >> /tmp/user_data 2>&1
    apt-get install -y --force-yes docker-engine >> /tmp/user_data 2>&1
    service docker start >> /tmp/user_data 2>&1
    # Non-root access
    groupadd docker >> /tmp/user_data 2>&1
    gpasswd -a ${USER} docker >> /tmp/user_data 2>&1
    service docker restart >> /tmp/user_data 2>&1
  curl -L "{{.API}}/download/worker/linux/$(uname -m)" -o worker --retry 10 --retry-max-time 120 -C - >> /tmp/user_data 2>&1
  chmod +x worker

cmd: "./worker --api={{.API}} --token={{.Token}} --basedir={{.BaseDir}} --model={{.Model}} --name={{.Name}} --hatchery={{.Hatchery}} --hatchery-name={{.HatcheryName}} --insecure={{.HTTPInsecure}} --single-use --force-exit"

post_cmd: sudo shutdown -h now