0

Using Open Nebula I have instantiated several virtual machines (qemu-kvm) with the Centos 6.5 image provided by Open Nebula Marketplace. Now I would like to install more applications on VMs and run some postscripts also. Although I could do this by doing ssh over each vm, but I would like to automate the process.

1 Answers1

0

We use Salt (http://www.saltstack.com) for exactly that.

Through some more or less complex configuration-files, you can have the machines automatically install software, configuration-files, users, ssh-keys, ...

You could for example set a rule, that any VM, who's FQDN starts with "web" has to install httpd.

Alternatives are Puppet (https://puppetlabs.com), Chef (https://www.chef.io/chef/), Ansible (http://www.ansible.com/home) and potentially a few others.

For the installation of Salt, we use an additional context-script in the VM (note, you'll have to add 'init.sh' and the other context-script), that takes care of the installation of the minion. The script looks somewhat like this (replace ##salt-master-FQDN## with the salt-master IP or fqdn):

#!/bin/sh

if [ ! -f /etc/salt/minion ]; then
    yum clean all
    yum -y update
    yum -y install salt-minion
    sed -i '/master:/c\master: ##salt-master-FQDN##' /etc/salt/minion
    systemctl enable salt-minion.service
    systemctl start salt-minion.service
fi
lucorlis
  • 263
  • 1
  • 2
  • 9
  • How will you install Salt on target vm, by ssh or create custom image for instantiation ? – Kshitiz Bartariya Jun 29 '15 at 08:32
  • We use another context-script for the installation of the salt-minion - added the code above. Once the vm is up and running, all you need to do is add the salt-key to the master, and it rushes through whatever you want that machine to do [adding ssh-keys is probably the first thing you would want to sort out]. – lucorlis Jun 29 '15 at 08:53