puppet on solaris tries to update vim-enhanced - vim

I have Solaris 10 operating system with puppet agent installed on it.
When I run puppet agent -t I get an Error:
Error: /Stage[main]//Package[vim-enhanced]/ensure: change from absent to latest failed: Could not update: Sun packages must specify a package source
I have no classes regarding updates of vim-enhanced on the master, so where is the error coming from ?
If I do have some classes that I'm not aware of, how do I specify a package source ?

You don't need to any classes, puppet "package" reference solving your problem.
Use this resource:
package {
'vim-enhanced':
ensure => present,
provider => rpm,
source => "puppet:///files/vim-enchanced.rpm";
}
But, only working if you are using puppet default file server!

Related

puppet master not able to find configdir, how to fix this?

sudo puppet master --verbose --no-daemonize
When I ran above command
[root#puppetmaster bin]# sudo puppet master --verbose --no-daemonize
/usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:1348:in convert': Error converting value for param 'basemodulepath': Could not find value for $configdir (Puppet::Settings::InterpolationError)
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:1337:ingsub'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:1337:in convert'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:1315:ininterpolate'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:1060:in value'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:121:in[]'
from /usr/lib/ruby/site_ruby/1.8/puppet.rb:184:in base_context'
from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:356:inrun'
from /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:146:in run'
from /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:92:inexecute'
from /usr/bin/puppet:8
Even I created a environment variable now with $configdir with value /etc/puppet, but still same issue.
Please suggest how to rectify this
Puppet does not ordinarily provide or rely on any "configdir" setting, but it does provide and rely on confdir. Since Puppet is complaining about being able to determine the value of a different parameter, basemodulepath, I infer that,
You are using Puppet 3.8 with directory environments enabled (Ruby 1.8 is not supported in later versions, and basemodulepath is a directory environments thing), and
One of your environment.conf files erroneously specifies a value for its environment's basemodulepath in terms of $configdir instead of $confdir.
Note that Puppet 3.8 is obsolete and unsupported. As I write this, the latest is Puppet 6.12.

Puppet 6.1.0: node.rb missing from installed files?

For testing, I have installed two instances of Ubuntu server 18.04 on VirtualBox. I then installed one with Puppet-server 6.1.0 and one with Puppet-agent 6.1.0, as per the documentation at Puppetlabs for version 6.1. Foreman is not installed.
After registering my agent at the puppetserver and signing the certificate, starting a puppet-run (sudo /opt/puppetlabs/bin/puppet agent --test) fails with the following error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Failed when searching for node puppetagent.fritz.box: Exception while executing '/etc/puppetlabs/puppet/node.rb': Cannot run program "/etc/puppetlabs/puppet/node.rb" (in directory "."): error=2, No such file or directory
I was dumbstruck to find that the script /etc/puppetlabs/puppet/node.rb was indeed missing and was also not included in the packages of puppetserver, puppet-agent or facter (sudo dpkg-query -L ...).
Googling for it, I only found a script of the same name that belonged to Foreman.
The file does also not seem to be present in the puppetserver source-code at github.
Is anyone able to shed some light on this?
Your server configuration seems to be set up to specify use of an external node classifier. This is optional: Puppet does not require an ENC and does not provide one by default. That's part of what makes them "external". If you obtained the result you describe straight out of the box then it probably reflects a packaging flaw that you should report.
In the meantime, you should be able to update the configuration to disable use of an ENC by changing the value of the node_terminus setting to plain. Alternatively, you should be able to just delete both node_terminus and external_nodes from your configuration, because the default for the former is plain.
Tagging on to John's answer, your configuration is probably configured to talk to the Foreman. If you didn't write it yourself or copy it from somewhere and you're sure you don't have any Foreman packages installed, then it's definitely a packaging error that you should report.
That said, puppet repos are almost always the right answer rather than distro packages.

puppet restrict installed modules based on osfamily

I have configured puppet manifest as below,
class main_config{
if $::osfamily == 'windows' {
}
else {
class{main_config::install:} ->
class{main_config::config:}
}
}
Also I have installed puppet modules that are needed for both Linux and Windows. When I run puppet agent on Linux there are also Windows related modules like powershell exec which are installed and are not needed for Linux absolutely.
I am looking for the way to restrict modules based on OS type to avoid unnecessary modules getting installed.
For example, when I install puppetlabs-powershell puppet module on puppet master, then when I run puppet agent on clients on linux server then this windows module is also getting installed.

Installing several RPMs with custom install flags

I'm trying to do the initial work to get our dev shop to start using vagrant + puppet during development. At this stage in my puppet manifest development, I need to install several RPMs that are available via an internal http server (not a repo) with very specific flags ('--nodeps').
So, here's an example of what I need to install:
http://1.2.3.4/bar/package1.rpm
http://1.2.3.4/bar/package2.rpm
http://1.2.3.4/bar/package3.rpm
I would normally install them in this way:
rpm --install --nodeps ${rpm_uri}
I would like to be able to do something like this
$custom_rpms = [
'http://1.2.3.4/bar/package1.rpm',
'http://1.2.3.4/bar/package2.rpm',
'http://1.2.3.4/bar/package3.rpm',
]
# edit: just realized I was instantiating the parameterized
# class wrong. :)
class { 'custom_package': package_file => $custom_rpms }
With this module
# modules/company_packages/manifests/init.pp
define company_package($package_file) {
exec { "/bin/rpm --install --nodeps ${package_file} --nodeps" }
}
But, I'm not sure if that's right. Can some of you puppet masters (no pun intended) school me on how this should be done?
You may have already worked around this by now, but if not.
Using a repository is the preferred method as it will autoresolve all the dependancies, but it that's not available you can try the following. (I'm using epel as an example rpm)
package {"epel-release":
provider=>rpm,
ensure=>installed,
install_options => ['--nodeps'],
source=>"http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm",
}
It used to be that 'install_options ' was only supported in windows.
It appears that it is now supported in linux.
If there is sequence that would be helpful, add "require=Package["package3.rpm"]," to sequence.
Answered by Randm over irc.freenode.net#puppet
Create or use an existing repo and install them with yum so that it resolves the dependencies for you.

rpm installation using puppet

I am new to Puppet - I have been playing around learning the basics. Most of the examples ( except the very basic ones ) that are on the puppet page do not work for me - either some dependency is missing or package is not found. I do not see the logs explaining what went wrong ( even if I run the --test or --verbose option)
Can anyone clarify
1 What is the simplest process ( set of simple steps ) for installing a rpm package on a single Linux box ?
2 In general - how does one go about using the modules on the forge.puppetlabs ? Are the providers for these packages installed automatically or they have to be manually installed first ?
To install a package named pacman from command line:
puppet resource package pacman ensure=present
Corresponding puppet code will look like:
package { 'pacman':
ensure => '4.0.3-5',
}
Explore for more options about the package resource here
Regarding the question of installing puppet modules, have a look here. Official doc is your friend :)
Personally, I just copy-paste the module directory manually in a git repo which I use to maintain my puppet code.

Resources