Installing a puppet module from a manifest script

后端 未结 8 2157
不思量自难忘°
不思量自难忘° 2020-12-12 15:27

I\'m using puppet to provision a vagrant (ubuntu based) virtual machine. In my script I need to:

sudo apt-get build-dep python-lxml

I know

8条回答
  •  温柔的废话
    2020-12-12 15:41

    I ran into this problem as well. The trick is to download the modules using a vagrant shell command before the puppet provisioner runs.

    config.vm.provision :shell do |shell|
      shell.inline = "mkdir -p /etc/puppet/modules;
                      puppet module install puppetlabs/nodejs;
                      puppet module install puppetlabs/apache"
    end
    
    config.vm.provision :puppet do |puppet|
      puppet.manifests_path = "puppet/manifests"
      puppet.manifest_file = "site.pp"
    end
    

    Order is important here, and since the puppet provisioner hasn't run the folder /etc/puppet/modules does not exist yet.

    The reason I decided, like alonisser, to install the modules using the puppet module tool instead of using a module folder with the vagrant puppet provisioner was because I didn't want to have to download all of the dependencies of the modules I was going to use and store all of those modules in my source control. Running these two commands results in 5 dependencies that would otherwise sit in my git repository taking up space.

提交回复
热议问题