Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all 6104 articles
Browse latest View live

Share data between invocations of custom function?

$
0
0
I have a [custom function](https://phabricator.wikimedia.org/diffusion/OPUP/browse/production/modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb) on a Puppet 3.8.5 master that reads a YAML file and returns some value. On the first invocation, the contents of the file are read into a class variable (`@@variable`) and subsequent invocations use that value unless the file has changed. This concept works nicely, but feels unsupported. Is there a documented way/best practice to share data between invocations of a custom function? Are there separate patterns for sharing data for the lifetime of the catalog run for one node vs. the lifetime of the puppetmaster?

Managing Group Policies or Local Policies with Puppet

$
0
0
Hi everyone, I'm evaluating a number of different tools to use to manage my environment of over 400 servers. It is a mixed environment running Windows and Linux but it is predominantly Windows. The intention in exploring a new tool is to use a single tool for all platforms, as much as possible. Right now, we use Group Policies and Local Policies to manage the configuration of the Windows servers joined and not joined to the domain respectively. Maybe I am mistaken, but I noticed that there is gap in Puppet's features when it comes to GPOs and Local Policies. I've not been able to find anything so far on how we can use Puppet to create, edit and deploy these policies, for example Remote Desktop security settings. if anyone can provide some insights into how this can be accomplished, it would be much appreciated. Thanks in advance

how to get the name of a defined resource inside itself?

$
0
0
Is there any way to find the *actual name* (i.e., not `$name` or `$title`) of a defined resource from inside its code? # this file is in modules/mymodule/manifests/mydefine.pp define mymodule::mydefine { notice("this define is ${something}") } ...and I want the notice to read "*this define is mydefine*" or "*this define is mymodule::mydefine*".

Could not run: Could not retrieve facts for node-5.domain.tld: invalid byte sequence in UTF-8

$
0
0
Hi, I am trying to deploy Fuel-OpenStack with OPNFV. I got the below error while deploying OPNFV. Could someone help on this ? Thanks for the help. The version of Puppet is Puppet v3.8.5. ------------------ 2017-01-03 02:38:07 ERR /usr/bin/puppet:8:in `
' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:92:in `execute' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:146:in `run' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/application.rb:381:in `run' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/util.rb:496:in `exit_on_fail' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/application.rb:381:in `block in run' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/application.rb:507:in `plugin_hook' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/application.rb:381:in `block (2 levels) in run' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:159:in `run_command' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:198:in `main' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet.rb:246:in `override' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:200:in `block in main' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/indirector/node/plain.rb:17:in `find' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/node.rb:125:in `fact_merge' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:201:in `find' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/puppet/indirector/facts/facter.rb:23:in `find' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter.rb:118:in `block (2 levels) in singletonclass' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/collection.rb:115:in `load_all' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/loader.rb:38:in `load_all' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/loader.rb:38:in `each' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/loader.rb:41:in `block in load_all' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/loader.rb:41:in `each' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/loader.rb:46:in `block (2 levels) in load_all' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/loader.rb:95:in `load_file' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/loader.rb:95:in `load' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/manufacturer.rb:66:in `' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/manufacturer.rb:34:in `dmi_find_system_info' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/manufacturer.rb:34:in `each_pair' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/manufacturer.rb:35:in `block in dmi_find_system_info' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/manufacturer.rb:35:in `each' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/manufacturer.rb:36:in `block (2 levels) in dmi_find_system_info' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/manufacturer.rb:36:in `each_pair' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/manufacturer.rb:37:in `block (3 levels) in dmi_find_system_info' 2017-01-03 02:38:07 ERR /usr/lib/ruby/vendor_ruby/facter/util/manufacturer.rb:37:in `split' 2017-01-03 02:38:07 ERR Could not run: Could not retrieve facts for node-5.domain.tld: invalid byte sequence in UTF-8 ------------------

name attribute doesn't in rspec-puppet

$
0
0
Hi, I have below manifests, file {'module_name' : ensure => present, name => '/etc/init.d/module_name', owner => 'root', group => 'root', mode => '0755', source => 'puppet:///modules/test/module_name', } Below is the rspec-puppet test case, when I run the test case getting error it { should contain_file('module_name').with( 'ensure' => 'present', 'name' => '/etc/init.d/module_name', 'owner' => 'root', 'group' => 'root', 'mode' => '0755', 'source' => 'puppet:///modules/test/module_name', )} Error Message: expected that the catalogue would contain File[module_name] with name set to "/etc/init.d/module_name" but it is set to nil when I make `'name' => nil`change then my test case did pass.

How do you call provider parent's prefetch method

$
0
0
I have a provider like this **Puppet::Type.type(:my_type).provide(:my_provider, :parent => :my_parent_provider)** And my_parent_provider has implemented self.prefetch(resources) and that is called when i use the my_provider provider. Now I would like to implement it also on my_provider but if do the it is only called on my_provider and not on my_parent_provider. How do make sure that both prefetch methods are called?

Hiera : correct lookup way

$
0
0
Hello all, I am currently reviewing some Hiera configuration file(s) and came across some elements which I would need advices about. Here's a Hiera configuration example : vstest: service_name: svc-id-tag additional_properties: c_url: "%{hiera('compliance_url')}" both **svc-id-tag** and **compliance_url** are Hiera keys located in another YAML configuration file and both ways actually work to retrieve the value. But what is the best ( recommended ) way to perform lookups ?

Could not render to Puppet::Network::Format[msgpack]: ""\xE2"" on US-ASCII

$
0
0
This started showing up and I am digging into it but in the meantime does anyone have an idea of what could be causing this? Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not render to Puppet::Network::Format[msgpack]: ""\xE2"" on US-ASCII Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Merging Hiera files From mulitiple Environments

$
0
0
Hello, I would like to merge a few puppet environments in to 2 : "production", "development". The environments/ modules /sites aspects of this merge are fine, but i am having difficulty with the Hiera data. We have hiera data that applies to an entire environment and i am looking for an alternate way of doing. ex: envs: test, preprod, prod desired envs: prod, test How does one merge the hiera data from preprod into the prod heira yaml file and still have it only apply to the pre prod servers?

Problems starting pe-console-services.service

$
0
0
Just before the completion of a fresh install of PE latest onto a CentOS 7 VM (8GB,4CPU), an error appears in the web console. It appears as though the pe-console-services.service fails to start although all other related pe-* services do start. systemctl start pe-console-services.service fails also. No logging at all appears in the /var/log/puppet.... console directory although perhaps that makes sense given that the service doesn't start to begin with. I can't see any obvious 'ERROR' log entries in the other log files and the installer log points to the journal and installation log but again nothing obvious. Has anyone else seen this problem or an I just missing something? Many thanks extraresolution

Stop Service, Replace files, then start service again

$
0
0
In my infrastructure we make use SoftEther as a vpn client. I need to upgrade all the clients. Unfortunately after very extensive checking even going through the source I found out SoftEther has no silent installer. However, after taking a snapshot of the hard drive and registry I've gone through every change the installer makes well upgrading. I basically just need to stop the softether service on windows, replace a bunch of exe's then restart the service. I wrote a powershell script that does just this and have tested it as being very reliable at upgrading the client. Now, I'm trying to figure out how to write a module that would maintain softether on all of our windows desktops. I could probably just use the powershell module to execute my script but that isn't very 'puppet' and I'd probably have to manually transfer all the files? Is there a better way of doing this? or can I access a modules files from the puppet masters IP? I'm pretty familiar with puppets dsl at this point but I'm also still fairly new.

install gem without internet connection

$
0
0
I have a sandbox server that I need to install some gems on, specifically rspec. How can I install this gem without doing a gem install command? Here is the github repo https://github.com/rodjek/rspec-puppet gem install rspec ERROR: Could not find a valid gem 'rspec' (>= 0) in any repository ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::ECONNREFUSED: Connection refused - connect(2) (http://rubygems.org/latest_specs.4.8.gz)

How to access custom facts from command line?

$
0
0
i installed the [puppetlabs-lvm][1] module which provides some custom facts like `lvm_pv_0` having the `warning($facts['lvm_pv_0'])` in my `site.pp` correctly outputs `/dev/md0` but running`facter | grep lvm` or `puppet facts | grep lvm` from command line does not return anything. i have not checked them all but it looks like that every custom fact is missing from the command line. how to access the custom facts from the command line? [1]: https://forge.puppet.com/puppetlabs/lvm

Puppet agent only run on demand on a windows agent

$
0
0
I have a large list of machine that I've deployed puppet agent on that are at customer location and could be very sensitive to changes. They are all running windows desktop OS's. I want to disable runinterval on all of them. I can't seem to figure out how to do that. The help section of the agent doesn't seem have any option that implies that might help with that. Runinterval doesn't seem to have numeric or boolean value to disable it. It says to use --no-client but that seems to be depreciated and wouldn't work on the windows service. There's a post stating to set daemonize to off for this however, the help documentation for puppet.conf implies that this option is already set to off on windows. Any suggestions? I assume this would be alot easier to accomplish. I'm surprised runinterval just doesn't accept a negative number to set it to 'off'.

Is it possible to have a syslog or snmp event trigger puppet to log into a network device and execute a config change?

$
0
0
case in point, if I have a nexus switch with two paths for default gateways and one goes down. Can I have some sort of event sent to puppet in order to trigger it to automatically log into the switch and change the default gateway? Thanks, Ian

How to generate a facts.yaml file using Puppet only once a day versus every 30 minutes?

$
0
0
Referencing the following code mentioned in https://docs.puppetlabs.com/mcollective/configure/server.html # /etc/puppet/manifests/site.pp file{"/etc/mcollective/facts.yaml": owner => root, group => root, mode => 400, loglevel => debug, # reduce noise in Puppet reports content => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime_seconds|timestamp|free)/ }.to_yaml %>"), # exclude rapidly changing facts } Trying to apply this to windows clients, I had to modify it this way: file { "c:/mcollective/etc/facts.yaml": loglevel => debug, content => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime_seconds|timestamp|free)/ }.to_yaml %>"), # exclude rapidly changing facts } Now this works fine in generating the file, however, it is constantly generating a 'change' to the system every time puppet runs. Is there a way to get this applied once ever day or an interval as we only need this updated for mcollective reporting unless something changes... And even with the exclusions, it should need to update unless there is a major change..

What's a good name for the fact if the server is production, staging or lab?

$
0
0
While reimplementing my enc, I stumbled upon the fact that I cannot seem to find a good name for the fact that denotes wether a server is production, staging or lab. Usually one would use 'environment' for this, but this already has a technical meaning in puppet, so I don't want to reuse the terminoligy. The best thing we came up till now is '$production\_level', but that feels a little clumsy. As I want to encode this fact into the certificate, the best would be if it was one of the predefined puppet certificate oids ([https://docs.puppet.com/puppet/latest/ssl\_attributes\_extensions.html\#puppet-specific-registered-ids]), but none of them fits well enough, so I'll probably use something like 'role=prod:mywebserverrole' and split them in site.pp. Did I overlook an obvious solution?

Will puppet continue to apply changes if it cannot reach the server again?

$
0
0
This is probably a no-brainer, but at this point it is more of a sanity check. I was under the impression it will only make changes if it can successfully pull down a catalog from the Puppet server. Another engineer was doing some work on a box that had Puppet run in the past, but is now on a network with no Puppet presence. He swears files were being changed, and I believe it was with files that we had Puppet configure. I guess to refine the question, if it runs successfully once, then the access to the Puppet server is completely removed for whatever reason, will it continue to apply the last set of configurations it received or will it no longer try since it cannot reach the Puppet server?

I am getting below error while installing rtyler/jenkins. Please help me to get rid of this problem.

$
0
0
Error Output [root@agent ~]# puppet agent --test Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Info: Caching catalog for agent.example.com Info: Applying configuration version '1483954140' Error: Could not find command 'jar' Error: /Stage[main]/Jenkins::Cli/Exec[jenkins-cli]/returns: change from notrun to 0 failed: Could not find command 'jar' Notice: /Stage[main]/Jenkins::Cli/File[/usr/lib/jenkins/jenkins-cli.jar]: Dependency Exec[jenkins-cli] has failures: true Warning: /Stage[main]/Jenkins::Cli/File[/usr/lib/jenkins/jenkins-cli.jar]: Skipping because of failed dependencies Notice: /Stage[main]/Jenkins::Cli/Exec[safe-restart-jenkins]: Dependency Exec[jenkins-cli] has failures: true Warning: /Stage[main]/Jenkins::Cli/Exec[safe-restart-jenkins]: Skipping because of failed dependencies Notice: /Stage[main]/Jenkins::Cli_helper/File[/usr/lib/jenkins/puppet_helper.groovy]: Dependency Exec[jenkins-cli] has failures: true Warning: /Stage[main]/Jenkins::Cli_helper/File[/usr/lib/jenkins/puppet_helper.groovy]: Skipping because of failed dependencies Notice: /Stage[main]/Jenkins/Anchor[jenkins::end]: Dependency Exec[jenkins-cli] has failures: true Warning: /Stage[main]/Jenkins/Anchor[jenkins::end]: Skipping because of failed dependencies Notice: Finished catalog run in 0.92 seconds

What is the correct settings for the JVM memory for the puppet server to start?

$
0
0
How do I fix the bad vendor preset? The platform is Ubuntu 64bit 16.04.1 desktop. After reviewing the log file I saw this: # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 1431699456 bytes for committing reserved memory. What is the correct settings for the JVM memory? ● puppetserver.service - LSB: puppetserver Loaded: loaded (/etc/init.d/puppetserver; bad; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2017-01-09 12:14:10 PST; 1min 19s ago Docs: man:systemd-sysv-generator(8) Process: 66204 ExecStart=/etc/init.d/puppetserver start (code=exited, status=1/FAILURE) Jan 09 12:14:09 ubuntu systemd[1]: Starting LSB: puppetserver... Jan 09 12:14:10 ubuntu systemd[1]: puppetserver.service: Control process exited, code=exited status=1 Jan 09 12:14:10 ubuntu systemd[1]: Failed to start LSB: puppetserver. Jan 09 12:14:10 ubuntu systemd[1]: puppetserver.service: Unit entered failed state. Jan 09 12:14:10 ubuntu systemd[1]: puppetserver.service: Failed with result 'exit-code'.
Viewing all 6104 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>