Question

I'm trying to create a development environment using Vagrant which depends on certain applications running inside of Docker containers.

The required environment is Ubuntu 12.04 LTS, which maps out to be the precise64 box in Vagrant. The problem is ensuring the following:

  1. The Saucy LTS kernel is installed.
  2. The Saucy LTS kernel is running.

I'm trying to provision the box using Puppet and I can't figure out a way to ensure that the following commands are executed:

apt-get install linux-image-generic-lts-saucy linux-headers-generic-lts-saucy
reboot

I'll obviously need to reboot the box for it to load and run the new kernel.

Is there a way I can define these items as dependencies in Puppet?

I'm looking to do something like this:

package { "lxc-docker":
    /* ... */
    requires => Package["lts-kernel-saucy"]
}

Any ideas on how I can accomplish this?

Was it helpful?

Solution 2

OTHER TIPS

If apt-get is the package manager puppet is using, then you can try the following :

  # Create an array of package names that need to be installed
  $mypack = [ "linux-image-generic-lts-saucy", "linux-header-generic-lts-saucy", "lts-kernel-saucy" ]

  # Install all the packages
  package { $mypack :
              ensure => installed,
  }

  # Install other package that depends on the packages above :
  package { "lxc-docker" :
     ensure => installed,
     requires => Package[$mypack],
  }

  # Create an `exec` that will reboot the machine if a new package is installed
  # `refreshonly` sits there waiting for something new to happen
  exec { "reboot_machine" :
     command => "shutdown -r now",
     path => "/bin:/usr/sbin:/sbin:/usr/local/sbin",
     subscribe => Package ["lxc-docker"],
     refreshonly => true,
  }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top