puppet

Vagrant+Puppet puppet.module_path not working

最后都变了- 提交于 2019-12-10 20:31:41
问题 So I have my Vagrant file set up like this: VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "hashicorp/precise64" config.vm.provision "puppet" do |puppet| puppet.manifests_path = "manifests" puppet.manifest_file = "site.pp" puppet.module_path = "modules" puppet.options = "--verbose --debug" end end Now when I vagrant ssh into my VM and then run puppet module install puppetlabs-apache , i get the following error: Error: Could not install

Do basic math inside Hiera

送分小仙女□ 提交于 2019-12-10 15:59:10
问题 I'm trying to set a crontab's weekday in hiera based on a custom fact and a basic modulo but I can't even figure out if it's possible. I'd like to do something like: cron-job: command: "do something" user: myuser hour: "%{::instance}" minute: "%{::instance}" weekday: "%{::instance}" % 7 Can that even be done? 回答1: No, this is not possible. Please keep in mind that the YAML is just data , not code. Hiera does offer some transformations using Interpolation Tokens, but there are only two

How to set up custom bash environment for different users with puppet?

不想你离开。 提交于 2019-12-10 13:16:37
问题 I'm just getting started with puppet (and vagrant) to set up the development environment for our team, which consists of 8+ developers, each of which have their particular bash configuration, etc. I've got all the software installed on the system to quickly deploy new development virtual machines, but I'm not sure the best way to set up the development environment for each particular user in an automated way (we will end up having several development environments and it would be convenient to

Vagrant, Puppet and nodejs module: throwing error on npm module installation

落爺英雄遲暮 提交于 2019-12-10 13:13:43
问题 I have the following manifest: include nodejs package { 'serve': ensure => latest, provider => 'npm', } I am using the puppetlab node.js module: http://forge.puppetlabs.com/puppetlabs/nodejs Vagrantfile: Vagrant::Config.run do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.provision :puppet do |puppet| puppet.manifests_path = '~/work/environments/default/' puppet.manifest_file = 'site.pp' puppet.module_path = '~/work/environments

Configure remote rulesets with Puppet

送分小仙女□ 提交于 2019-12-10 11:29:12
问题 I'm trying to automate the Prometheus node_exporter and my Prometheus Server. For the node_exporter I've written a module to install all the needed packages, set the $::ipaddress based on facter and some more.. Now I'd like to make sure that the collected informations ( $hostname , $job_name , [...]) from the applying node are exported into the respective remote Prometheus configfile, but I want to have this step done asynchronously, so for example with a puppet agent run afterwards on the

Puppet - set defaults in manifest if not present in hiera when iterating over hash

最后都变了- 提交于 2019-12-10 10:25:56
问题 I am iterating over many entries in a hiera hash, and wish to remove identical duplicate lines from hiera by setting defaults in the manifest (such as ensure , groups , managehome etc), and have the defaults overridden IF the duplicate key/value pair exists in hiera. To date, everything I have tried fails to get the default values. I get the idea that I need to declare a resource, but am uncertain. I have tried setting "default_values_hash" in the lookup and other methods, but nothing appears

How to include a subtemplate in a Puppet template

笑着哭i 提交于 2019-12-09 19:43:33
问题 I'm trying to include a subtemplate in a template for one of my Puppet modules. Here's how I do the include in my base template: <% def import(fname) erb = File.open(File.dirname(__FILE__) + "/" + fname) { |fp| ERB.new(fp.read) } erb.run end %> <%= import("subtemplate.erb") %> This works fine if I render it with erb command-line tool. However, during the Puppet run the import is silently ignored, i.e. the base template is rendered with a blank line where the rendered subtemplate should be.

conditional within define in puppet

不羁的心 提交于 2019-12-09 18:51:24
问题 Running Puppet 3.8 I have two defines: define desktop::vinstall () { package { $title: ensure => installed, allow_virtual => true, configfiles => keep, } } and define desktop::vinstallwseeds () { package { $title: ensure => installed, allow_virtual => true, configfiles => keep, require => File["/var/cache/debconf/pkg-${title}.seeds"], responsefile => "/var/cache/debconf/pkg-${title}.seeds", } file { "/var/cache/debconf/pkg-${title}.seeds": source => "puppet:///modules/desktop/pkg-${title}

How can I split my hiera config by role?

爷,独闯天下 提交于 2019-12-09 11:52:57
问题 I'm using hiera to assign classes like webserver or dbserver to my nodes. The webserver class just includes apache and sets some config on it (e.g. port). Obviously I don't want to replicate this config for every node, so I put it in common.yaml. However, my common.yaml is getting big, so I want to split it up. I'd like to have one file containing the config for the webserver role, another for the dbserver role etc. I'm imagining my hiera.yaml to look something like this: :hierarchy: - "fqdn/