[Puppet Users] Is there a way to see find out if a module is installed for use?
Hi List, Is there a puppet command to find out what modules are available for use or at least a module to return a boolean value if you pass it a module name you wish to use? I am looking to do something like: if is_module_available(stdlib) { # Use stdlib capability } else { # Use my own version } Thanks, Peter -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Puppet stdlib - Is there a validate_in function
Hi List, As part of my module pre-checks I would like to confirm that a value passed in for the state of a package is part of two valid values. Currently I am doing this by: $valid_ensure_values = [ "present", "absent" ] if ! ("$::{ensure}" in $::{valid_ensure_values}) { $test_ = inline_template("<%= ($::apt-cacher-ng::params::valid_ensure_values).join(', ') %>") fail("${module_name}::server - Invalid ensure value [currently - ${ensure}], valid values are [$::{valid_ensure_values}]") } I was hoping that I could just simply do a: validate_in($::{ensure}, $::{valid_ensure_values}) I have checked the documentation at https://github.com/puppetlabs/puppetlabs-stdlib and looked in the lib/puppet/parser directory and cannot see anything. Thanks, Peter. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Unable to import a manifest file from a different directory to the one where site.pp is located using environments
Hi List, Puppet Version: v2.7.13 Question - If I correctly setup multiple manifestdir's in the puppet.conf file how can I import a node pp file located in a different directory tree to site.pp? My configuration information is below. In my puppet.conf file I have setup an environment called "stable", within this environment I have setup the manifestdir, modulepath and manifest settings like so: - (Begin Extract) [stable] *manifestdir*=/srv/puppetmaster/stable/manifests:* /srv/puppetmaster/stable/site-nodes* modulepath=/srv/puppetmaster/stable/modules:/srv/puppetmaster/stable/site-modules *manifest=/srv/puppetmaster/stable/manifests/site.pp* - (EndExtract) If I run a config print against the manifestdir against the stable environment it outputs the correct paths: - (Begin Extract) root@core ~# *puppet config print --environment stable manifestdir* /srv/puppetmaster/stable/manifests:/srv/puppetmaster/stable/site-nodes - (EndExtract) In my site.pp file I have - (Begin Extract) root@core stable/manifests# pwd /srv/puppetmaster/stable/manifests root@core stable/manifests# cat site.pp Exec { path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" } import "core.mob.ifoley.local.pp" node default { fail (" Please create a node file for this computer ! ") } - (EndExtract) In my core.mob.ifoley.local pp file I have - (Begin Extract) root@core stable/site-nodes# pwd /srv/puppetmaster/stable/site-nodes root@core stable/site-nodes# cat core.mob.ifoley.local.pp node 'core.mob.ifoley.local' { notice("Inside core pp file") } - (EndExtract) On the puppet client when I run the Puppet apply it gives the below output. - (Begin Extract) root@core ~# puppet agent --server puppet.mob.ifoley.local --environment stable --no-daemonize --verbose --onetime info: Retrieving plugin info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb *err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment stable: No file(s) found for import of 'core.mob.ifoley.local.pp' at /srv/puppetmaster/stable/manifests/site.pp:8 on node core.mob.ifoley.local* info: Not using expired catalog for core.mob.ifoley.local from cache; expired at Wed Apr 25 08:22:31 +1000 2012 notice: Using cached catalog err: Could not retrieve catalog; skipping run - (EndExtract) If I move the core.mob.ifoley.local.pp file into the same directory as the site.pp file then it correctly imports the file and spits out the notice message. Am I doing something wrong? Any help would be greatly appricated. Thanks, Peter. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Can you check a setting set in puppet.conf from within a module
Hi List, In a module that I am developing I would like to do different things depending on if storeconfigs is true or false. Is there any way to: if $storeconfigs == true { # Use stored config values } else { # Use non stored config values } Thanks, Peter. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.