5.5. Adding a new machine type
There are several tools and config files that need to know what types of machines are available for provisioning on a particular Genome Appliance machine. To simplify this process Genome includes a DSL (Domain Specific Language) for describing the machines available.
Let's start with an example for creating a new developer workstation machine type. It's important to get all the wiring setup to make puppet and your machine aware of the new module before adding too much function.
The first step is usually to create a stubbed out module on the Genome Appliance and use genome-sync to setup the right information. To do this, run these steps (on the Genome Appliance):
# Switch to the genome user su - genome # Create a working directory (the 'puppet' directory is important) mkdir -p /tmp/working/puppet/dev_workstation/manifests cd /tmp/working/puppet/dev_workstation # Create a simple puppet configuration # The name of the class must match the directory name echo """ class dev_workstation { package { 'vim-enhanced': ensure => latest; } } """ > manifests/init.pp # Make the directory a git repository git config --global user.email "you@example.com" git config --global user.name "Your Name" git init git add . git commit -m "Priming the dev_workstation module" # Run genome-sync to publish this module # This sets up the 'public' git repositories # and the puppet working directory genome-sync save --workingdir=/tmp/working # This is probably a bug in puppet, but you # need to restart the puppetmaster when you introduce # a new module su - service puppetmaster restart exit
At this point, you should see the git repositories listed on your Genome Appliance at http://$GENOME/git/gitweb.cgi
The next step is to update the Genome DSL file to make it aware of a new 'machine' that contains this new puppet class. Machines can consist of multiple puppet classes, but in this case, we are starting simple. To do this, run these steps (on the Genome Appliance):
# Make sure the permissions are okay on the machine_types.rb file su - chown genome:genome /etc/genome/machine_types.rb chown -R genome:genome /etc/puppet/modules/main exit # Switch to the genome user to update the machine_types.rb file su - genome # Clone the repo_extensions repository git clone /pub/git/puppet/repo_extensions /tmp/repo_extensions cd /tmp/repo_extensions # Add the new machine consisting of your new puppet module echo """ newmachine('developer-workstation') do set_classes 'dev_workstation' end """ >> files/machine_types.rb # Commit and push the change git add . git commit -m "Adding the new developer-workstation machine" git push
After you have pushed your changes, they will be applied the next time puppet runs on the repo, which is usually in 5 to 10 minutes. However, for the sake of this example, we will manually kick off a puppet run:
# Force a puppet run su - puppetd --test
At this point, you should see your new machine type listed on your Genome Appliance at http://$GENOME/genome/machine_types.html
genome-sync is a great way to handle moving custom machine types from one Genome Appliance to another.