10

I have a pip style requirements.txt file I use for keeping track of my python dependencies, I'm moving my dev environment over to vagrant + puppet. So far I've been using the pip provider built into puppet to install individual packages like this:

package {
  ["django", "nose"]:
      ensure => present,
      provider => pip
}

Is it possible to pass in my requirements.txt instead and have puppet keep the packages up to date whenever that file changes?

piohhmy
  • 103
  • 1
  • 4

1 Answers1

8

Yes it is possible. Instead of defining a package resource, define a "exec" resource instead that will take the requirements.txt as variable and runs the pip install command.

E.g.

class pip_install(
 $path_requirements_file,
){

  exec { "pip_requirements_install":
    command     => "pip install -r ${path_requirements_file}",
    refreshonly => true,
  }

}
cocheese
  • 512
  • 2
  • 9