Home SaltStack-Formulas Project Introduction

Quick Deploy with Vagrant

Single deployments are a great way to setup an infrastructure for:

  • a service development environment
  • an overview of how all of the OpenStack services and roles play together
  • a simple lab deployment for testing

Although single builds aren’t suitable for large production deployments, they’re great for small proof-of-concept deployments.

It’s strongly recommended to have hardware that meets the following requirements before starting an AIO deployment:

Vagrant Setup

Installing Vagrant is extremely easy for many operating systems. Go to the Vagrant downloads page and get the appropriate installer or package for your platform. Install the package using standard procedures for your operating system.

The installer will automatically add vagrant to your system path so that it is available in shell. Try logging out and logging back in to your system (this is particularly necessary sometimes for Windows) to get the updated system path up and running.

Add the generic ubuntu1604 image for virtualbox virtualization.

$ vagrant box add ubuntu/xenial64

==> box: Loading metadata for box 'ubuntu/xenial64'
    box: URL: https://atlas.hashicorp.com/ubuntu/xenial4
==> box: Adding box 'ubuntu/xenial64' (v20160122.0.0) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/ubuntu/boxes/xenial64/versions/20160122.0.0/providers/virtualbox.box
==> box: Successfully added box 'ubuntu/xenial64' (v20160122.0.0) for 'virtualbox'!

Environment Setup

The environment consists of three nodes.

FQDN Role IP
config.cluster.local Salt master node 10.10.10.200
service.cluster.local Managed node 10.10.10.201

Minion Configuration Files

Download salt-formulas

Look at configuration files for each node deployed.

scripts/minions/config.conf configuration:

id: config.cluster.local

master: 10.10.10.200

scripts/minions/service.conf configuration:

id: service.cluster.local

master: 10.10.10.200

Vagrant Configuration File

The main vagrant configuration for SaltStack-Formulas deployment is located at scripts/Vagrantfile.

# -*- mode: ruby -*-
# vi: set ft=ruby :

boxes = {
  'ubuntu/xenial64' => {
    'name'  => 'ubuntu/xenial64',
    'url'   => 'ubuntu/xenial64'
  },
}

Vagrant.configure("2") do |config|

  config.vm.define :cluster_config do |cluster_config|

    cluster_config.vm.hostname = 'config.cluster.local'
    cluster_config.vm.box = 'ubuntu/xenial64'
    cluster_config.vm.box_url = boxes['ubuntu/xenial64']['url']
    cluster_config.vm.network :private_network, ip: "10.10.10.200"

    cluster_config.vm.provider :virtualbox do |vb|
      vb.customize ["modifyvm", :id, "--memory", 512]
      vb.customize ["modifyvm", :id, "--cpus", 1]
      vb.name = 'cluster-config'
      vb.gui = false
    end

    cluster_config.vm.provision :salt do |salt|
      salt.minion_config = "minions/config.conf"
      salt.colorize = true
      salt.bootstrap_options = "-F -c /tmp -P"
    end
  
  end

  config.vm.define :cluster_service do |cluster_service|

    cluster_service.vm.hostname = 'service.cluster.local'
    cluster_service.vm.box = 'ubuntu/xenial64'
    cluster_service.vm.box_url = boxes['ubuntu/xenial64']['url']
    cluster_service.vm.network :private_network, ip: "10.10.10.201"

    cluster_service.vm.provider :virtualbox do |vb|
      vb.customize ["modifyvm", :id, "--memory", 4096]
      vb.customize ["modifyvm", :id, "--cpus", 1]
      vb.name = 'cluster-servie'
      vb.gui = false
    end

    cluster_service.vm.provision :salt do |salt|
      salt.minion_config = "minions/service.conf"
      salt.colorize = true
      salt.bootstrap_options = "-F -c /tmp -P"
    end
  
  end

end

Launching Vagrant Nodes

Check the status of the deployment environment.

$ cd /srv/vagrant-cluster
$ vagrant status

Current machine states:

cluster_config          not created (virtualbox)
cluster_service         not created (virtualbox)

Setup config node, launch it and connect to it using following commands, it cannot be provisioned by vagrant salt, as the salt master is not configured yet.

$ vagrant up cluster_config
$ vagrant ssh cluster_config

Salt master Bootstrap

Bootstrap the salt master service on the config node, it can be configured with following parameters:

$ export RECLASS_ADDRESS=https://github.com/salt-formulas/salt-formulas-model.git
$ export CONFIG_HOST=config.cluster.local

To deploy salt-master from packages, run on config node:

$ /vagrant/bootstrap/salt-master-setup.sh

Now setup the server node. Launch it using following command:

$ vagrant up cluster_service

To orchestrate all defined services accross all nodes, run following command on config node:

$ salt-run state.orchestrate orchestrate