The goal is to automatically create variations of virtual machines images for a cloud infrastructure (OpenStack or Amazon are currently supported) using SaltStack based configuration files available in a given Mercurial repository.
The AMI builder tool can be used in two ways:
For a virtual machine in the cloud (private or Amazon), having a preconfigured AMI helps you gain setup time and execution time.
Instead of having an “install and configure each instantiation of a machine” we go for a “install once, run multiple times” approach.
Another benefit of this approach is that you have a repeatable environnement.
If you’re already using SaltStack, you can easily reuse your salt states to setup a custom AMI.
To create your first working image, follow these instructions:
Get the code
hg clone http://hg.logilab.org/master/salt-ami-cloud-builder/
Install salt-minion and dependencies (as root)
sudo apt-get install salt-minion python-apt
Configure salt (edit /etc/salt/minion):
set to masterless mode
file_client: localset state and modules source as local folder
file_roots: base: - /home/user/src/salt-ami-cloud-builder/
Edit your configuration file
cd salt-ami-cloud-builder
cp user_data.cfg.sample user_data.cfg
vim user_data.cfg
You should remove the unsed parts.
Set the environment variables by sourcing the config file
sudo python others/ec2_ami_parser.py user_data.cfg
Run salt
sudo salt-call saltutil.sync_modules
sudo salt-call saltutil.sync_states
sudo salt-call state.sls ami_builder
Warning
At this point, do NOT run a highstate (salt-call state.highstate), as this would modify multiple important system files from your system.
If you got only green and blue outputs, everything should be ok.
You are now the proud owner of a variation.img file containing your dear AMI, in /mnt/output.
For further documentation (installation, deployment, examples, etc) see the docs/ folder.
Contents: