Using puppet module straight from a cloned repo - vagrant

I'm trying to use puppet module in a vagrant setup. In a worked around the problem I tried to solve in this stackoverflow question.
I cloned the puppet module repo (apt module and nodejs module) into a sub folder
set the puppet module path in the vagrantfile
And include the puppet modules and call them in the puppet manifest file for example:
class { 'apt':
}
include apt
class{ 'apt':} -> apt::builddep { ["python-imaging","python-lxml"]:
require => Class['apt']
}
I wonder, maybe there is an install/build step I'm missing when I just git clone the repo? is this even possible to do?
The error message:
←[0;37mdebug: importing '/tmp/vagrant-puppet/modules-0/apt/manifests/init.pp' in
environment production←[0m
←[0;37mdebug: Automatically imported apt from apt into production←[0m
←[0;37mdebug: importing '/tmp/vagrant-puppet/modules-0/apt/manifests/params.pp'
in environment production←[0m
←[0;37mdebug: Automatically imported apt::params from apt/params into production
←[0m
←[0;37mdebug: importing '/tmp/vagrant-puppet/modules-0/apt/manifests/update.pp'
in environment production←[0m
←[0;37mdebug: Automatically imported apt::update from apt/update into production
←[0m
Unknown function validate_bool at /tmp/vagrant-puppet/modules-0/apt/manifests/in
it.pp:36 on node precise32
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cd /tmp/vagrant-puppet/manifests && puppet apply --verbose --debug --modulepath
'/etc/puppet/modules:/tmp/vagrant-puppet/modules-0' default.pp --detailed-exitco
des || [ $? -eq 2 ]

You are missing the stdlib module, which is a dependency at least of the apt module, and which provides, among other things, the validate_bool function Puppet can't find.
You can find the stdlib module here:
https://github.com/puppetlabs/puppetlabs-stdlib
Use the Puppet module installation tool rather than just cloning a single repo.
http://docs.puppetlabs.com/puppet/latest/reference/modules_installing.html
or better yet use librarian-puppet.

Related

Installing puppetlabs/apt fails with '302 Found'

So I have a vagrant / puppet setup for my project* and am running Ubuntu 14.04 on it. It just broke, without changing anything. puppet module install puppetlabs-apt inside the VM fails with the following lines:
Error: Could not execute operation for 'puppetlabs/apt'
The server being queried was https://forge.puppetlabs.com
The HTTP response we received was '302 Found'
Check the author and module names are correct.
I'm using this module for quite some time and it seems like it just stopped working for no reason. Any advice appreciated.
-- Edit: answer question
running it with --debug doesn't help much I guess
Notice: Preparing to install into /home/vagrant/.puppet/modules ...
Notice: Created target directory /home/vagrant/.puppet/modules
Notice: Downloading from https://forge.puppetlabs.com ...
Error: Could not execute operation for 'puppetlabs/apt'
The server being queried was https://forge.puppetlabs.com
The HTTP response we received was '302 Found'
Check the author and module names are correct.
*Link: https://github.com/dwalldorf/owTracker
vagrant up / vagrant ssh and puppet module install puppetlabs-apt
This should be fixed. You can check FORGE-327 for more information
https://forge.puppetlabs.com/puppetlabs/apt redirect to https://forge.puppet.com/puppetlabs/apt
you can force it to use the correct forge by appending --module_repository https://forge.puppet.com/ so it will become
puppet module install puppetlabs-apt --module_repository https://forge.puppet.com/
not sure exactly why it wants to download from https://forge.puppetlabs.com at first place, you could check your puppet.conf

Why is /var/lib/dpkg/status missing on a BitBake-generated OS?

I have installed apt onto a system built by BitBake by adding the apt package to the IMAGE_INSTALL variable in my recipe.
apt-get and apt-cache now execute on the built system, but if I try to do anything useful with them (such as apt-get update or apt-cache search), I get the following error:
E: Could not open file /var/lib/dpkg/status - open (2: No such file or directory)
E: The package lists or status file could not be parsed or opened
After some preliminary searching, I found this exchange on the Yocto Project mailing list:
Hi,
I have some requirement with apt-get in yocto genearted rootfs.
I built the yocto source code with enabling the apt package.
But after booting the image on my machine and run the "apt-get" command for installing some package it gives the following error.
Could not open the file /var/lib/dpkg/status open(2: no such a file or directory).
The package lists or status files could not be parsed or opened.
This error is because you need to add package-management to EXTRA_IMAGE_FEATURES in local.conf,
PACKAGE_CLASSES ?= "package_deb"
EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"
I've added package-management but don't see any different output.
After a touch /var/lib/dpkg/status, apt-get update returns the following:
Reading package lists...Done
How can I get apt into a functioning state through the use of BitBake metadata?
I have found a similar thread from the NXP website.
You would need to set up your own web server and provide all those packages and add the server URL to the source list. SourceList
In addition, you have to update the package manifest by running bitbake package-index and add PACKAGE_CLASSES ?= " package_deb" to conf/local.conf
I have successfully set up OPKG before. The steps are similar, you can find it here

The postfix module does not support the Debian family of operating systems

I have a vagrant and virtual box configuration and I tried installing postfix using puphet but I can't proceed because I always encounter this error when I run vagrant up or vagrant provision
Info: Loading facts in /etc/puppet/modules/rabbitmq/lib/facter/rabbitmq_erlang_cookie.rb
Warning: Could not retrieve fact fqdn
Error: The postfix module does not support the Debian family of operating systems. on node teaser-site-mgr
Error: The postfix module does not support the Debian family of operating systems. on node teaser-site-mgr
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
FACTER_ssh_username='vagrant' puppet apply --verbose --hiera_config /vagrant/puphpet/puppet/hiera.yaml --parser future --manifestdir /tmp/vagrant-puppet/manifests --detailed-exitcodes /tmp/vagrant-puppet/manifests/manifest.pp || [ $? -eq 2 ]
Stdout from the command:
and in my manifest.pp
class {'postfix':
remove_sendmail => false,
myorigin => undef,
relayhost => undef,
relayhost_port => undef,
}
I also added this mod in Puppetfile
mod 'postfix', :git => 'https://github.com/Aethylred/puppet-postfix'
Please help anyone m(_ _)m
#felix-frank --parser future is def. required by PuPHPet. Please don't remove this.
#inferno, the issue is you're trying to use this puppet-postfix module in a Debian OS, when it clearly states it does not support Debian.
Might I suggest https://github.com/example42/puppet-postfix ?
It seems that the error(s) I encountered is also somehow my fault.
Its because the puppet version now in my vagrant is 3.5.x (i created the config months ago) and i didn't noticed that the puphpet.com config has been also updated
and also the required puppet version is just 3.4.x
So when I run vagrant provision, the puppet version is updated to latest version which is 3.5.x (because of outdated puphpet config) thats why I always encounter the error (and sometimes syntax error)
im just wondering why puppet version 3.0 to 3.5 is now unsupported (but still puphpet.com is using it for vagrant) http://docs.puppetlabs.com/release_notes/
But anyways, thank you very much for your help guys :) I won't notice my mistake without all of your help m(_ _)m

Ensure node is running at least a certain kernel version?

I'm trying to create a development environment using Vagrant which depends on certain applications running inside of Docker containers.
The required environment is Ubuntu 12.04 LTS, which maps out to be the precise64 box in Vagrant. The problem is ensuring the following:
The Saucy LTS kernel is installed.
The Saucy LTS kernel is running.
I'm trying to provision the box using Puppet and I can't figure out a way to ensure that the following commands are executed:
apt-get install linux-image-generic-lts-saucy linux-headers-generic-lts-saucy
reboot
I'll obviously need to reboot the box for it to load and run the new kernel.
Is there a way I can define these items as dependencies in Puppet?
I'm looking to do something like this:
package { "lxc-docker":
/* ... */
requires => Package["lts-kernel-saucy"]
}
Any ideas on how I can accomplish this?
If apt-get is the package manager puppet is using, then you can try the following :
# Create an array of package names that need to be installed
$mypack = [ "linux-image-generic-lts-saucy", "linux-header-generic-lts-saucy", "lts-kernel-saucy" ]
# Install all the packages
package { $mypack :
ensure => installed,
}
# Install other package that depends on the packages above :
package { "lxc-docker" :
ensure => installed,
requires => Package[$mypack],
}
# Create an `exec` that will reboot the machine if a new package is installed
# `refreshonly` sits there waiting for something new to happen
exec { "reboot_machine" :
command => "shutdown -r now",
path => "/bin:/usr/sbin:/sbin:/usr/local/sbin",
subscribe => Package ["lxc-docker"],
refreshonly => true,
}
The best and easiest solution here is to use a Vagrant box which supports Docker by running the right kernel.

How do I uninstall DMG's with puppet?

So I have a local DMG that I'm installing with puppet (VirtualBox-4.2.18-88780-OSX.dmg), and I run it with
sudo puppet resource package virtualbox ensure=present provider=pkgdmg source=puppet:///virtualbox/VirtualBox-4.2.18-88780-OSX.dmg,
and everything works fine. But when I try to remove it with sudo puppet resource package virtualbox ensure=absent, I get an error
Error: Could not set 'absent' on ensure: undefined method 'uninstall' for #<Puppet::Type::Package::ProviderPkgdmg:0x107cb8218>
I have a vague idea of why this is happening, it doesn't look like puppet is recognizing the virtualbox uninstall tool. How do I fix this?
millmouse is correct OS X packages can't be uninstalled, at least by this method. Puppet doesn't support 'absent' on appdmg or apppkg providers.
You can however trick Puppet to reinstall a package by removing the 'cookie' like file it creates to track the package was installed. Puppet creates a file in /var/db with a pattern like .puppet_<provider>_installed_<package_name>-<version> on OS X; for example you'll have a file like /var/db/.puppet_pkgdmg_installed_VirtualBox-4.2.18-88780
You could do something like the following, but it won't actually uninstall the app only trick Puppet into allowing it to be installed again:
exec {'rm -f .puppet_pkgdmg_installed_VirtualBox-4.2.18-88780':
cwd => /var/db/',
user => 'root',
onlyif => 'test -f /var/db/.puppet_pkgdmg_installed_VirtualBox-4.2.18-88780',
}
or
file {'/var/db/.puppet_pkgdmg_installed_VirtualBox-4.2.18-88780':
ensure => 'absent',
force => true,
}
Otherwise the version number or name of the package needs to change in order to install again.
I would use an exec resource to do the uninstall rather than the package resource.
exec { "uninstall_mypkg" :
command => "uninstall mypkg",
onlyif => "check if the package is installed",
path => "/path/to/command/",
}

Resources