Installing a puppet module from a manifest script

后端 未结 8 2049
不思量自难忘°
不思量自难忘° 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 16:01

    @brain_bacon's strategy worked almost perfectly for me, with one small caveat - if the module already exists, then the provisioning script fails, halting the provisioning process. The following adjustment fixed this:

    config.vm.provision :shell, :run => "always" do |shell|
      shell.inline = %{
        mkdir -p /etc/puppet/modules;
        function install_module {
          folder=`echo $1 | sed s/.*-//`
          if [ ! -d /etc/puppet/modules/$folder ]; then
            puppet module install $1
          fi
        }
        install_module stdlib
        install_module apt
        install_module ruby
      }
    end
    

提交回复
热议问题