Partager via


The simplest configuration tool - Itamae

Now I'm try to investigate ARM related technologies. ARM is a great tool. I can provision servers, networks, and services quite easily using ARM. 

However, ARM is not good at configuring software on a virtual machine. We can use shell extension. However, it works only the first time.  

So the turn around time of testing takes too long.  I'd like to find out simple way to provision something. XP forks said that "So always do the simplest thing that could possibly work next. "

I come up with two solutions. One is Itamae. The other is chef-provisioning-rm. Both looks great. I try Itamae on this post.

Itamae

Itamae (https://github.com/itamae-kitchen/itamae) is very simple configuration tool inspired by Chef.

She is an itamae which means an experienced Japanese food cook. 

Tutorial 

1. Install itamae

You need install ruby in advance. I just install Vagrant and ChefDK.

Vagrant: https://www.vagrantup.com/

ChefDK: https://downloads.chef.io/chef-dk/

Vagrant: 

Then 

$ gem install itamae

Of course, you can use bundler.

2. Create a virtual machine

Create an Ubuntu image. 

Vagrantfile

 VAGRANTFILE_API_VERSION = "2"

  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    config.vm.box = "ubuntu/trusty64"

    config.vm.provider "virtualbox" do |v|

       v.name = "itamae-vagrant"

    end

end

Then

$ vagrant up

3. Write a recipe

recipe.rb

execute 'apt-get-upgrade' do

  command 'apt-get upgrade -y'

end 

execute 'apt-get update' do

  command 'apt-get update -y'

end

package 'nginx' do

  action :install

end

service 'nginx' do

  action [:enable, :start]

end

4. Execute it

You can execute an itamae recipe on a target machine. Or via SSH. It has an option for Vagrant.

$ bundle exec itamae ssh --vagrant --host default recipe2.rb 

 INFO : Starting Itamae...

 INFO : Recipe: /Users/ushio/Codes/itamae/recipe2.rb

 INFO : execute[apt-get-upgrade] executed will change from 'false' to 'true'

 INFO : execute[apt-get update] executed will change from 'false' to 'true'

 INFO : package[nginx] installed will change from 'false' to 'true'

That's it. Deadly simple.

You can refer some other usages on this GitHub repository. 

https://github.com/itamae-kitchen/itamae

It works fine with ARM.

The only problem is we can't perfectly automate a provisioning task. 

Then we can use chef-provision-rm. ;)  See you soon. Happy provisioning.