I've just spent a good deal of time setting up a puppet vagrant environment that works with r10k for testing my dev branch. everything is working and paths are fine but I declare 2 classes which are
class helloworld{
notify {'its best to test while wearing a vest':}
}
and
class helloworld::motd{
file {'/etc/motd':
owner => 'root',
group => 'root',
mode => '0644',
content => "Hello mike, that's a nice trike!\n",
}
}
then run 'vagrant provision' after modifying site.pp to include them.
my output is this
λ vagrant provision
==> default: vagrant-r10k: Puppet provisioner module_path is nil, assuming puppet4 environment mode
==> default: vagrant-r10k: Puppet provisioner module_path is nil, assuming puppet4 environment mode
==> default: vagrant-r10k: Puppet provisioner module_path is nil, assuming puppet4 environment mode
==> default: vagrant-r10k: Beginning r10k deploy of puppet modules into C:/scratch/test/environments/dev/modules using C:/scratch/test/environments/dev/Puppetfile
INFO -> Loading modules from Puppetfile into queue
INFO -> Deploying sssd into C:/scratch/test/environments/dev/modules
INFO -> Deploying ssh into C:/scratch/test/environments/dev/modules
INFO -> Deploying firewall into C:/scratch/test/environments/dev/modules
INFO -> Deploying concat into C:/scratch/test/environments/dev/modules
INFO -> Deploying stdlib into C:/scratch/test/environments/dev/modules
INFO -> Deploying resolv_conf into C:/scratch/test/environments/dev/modules
INFO -> Deploying mysql into C:/scratch/test/environments/dev/modules
INFO -> Deploying apache into C:/scratch/test/environments/dev/modules
INFO -> Deploying ntp into C:/scratch/test/environments/dev/modules
INFO -> Deploying helloworld into C:/scratch/test/environments/dev/modules
==> default: vagrant-r10k: Deploy finished
==> default: Running provisioner: puppet...
==> default: Running Puppet with environment dev...
==> default: Notice: Compiled catalog for devbox-vagrant.debisair.loc in environment dev in 0.37 seconds
==> default: Notice: its best to test while wearing a vest
==> default: Notice: /Stage[main]/Helloworld/Notify[its best to test while wearing a vest]/message: defined 'message' as 'its best to test while wearing a vest'
==> default: Error: Could not back up /etc/motd: Error 403 on SERVER: Forbidden
==> default: Error: Could not back up /etc/motd: Error 403 on SERVER: Forbidden
==> default: Error: /Stage[main]/Helloworld::Motd/File[/etc/motd]/content: change from {md5}d41d8cd98f00b204e9800998ecf8427e to {md5}7456822482f83301f8a4ad785e710898 failed: Could not back up /etc/motd: Error 403 on SERVER: Forbidden
==> default: Notice: Applied catalog in 5.13 seconds
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
I'm confused. seems like a rights issue? the trouble is this all works swimmingly in my test/uat/live environments. I'm specifically trying to get vagrant to work, but this is a vagrant box that I'm not even sshing into to run the provisioner. it's just a vagrant function. does anyone know what I'm doing wrong here?
I realise this is probably something of a vagrant question rather than a puppet question, but I'm using
puppetlabs/centos-7.0-64-puppet
provided by puppetlabs for vagrant. it seems like I need to modify file permissions or something, but i'm not sure. for the sake of it here's my vagrant file.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# test that puppet is installed as a Vagrant plugin
# you can't use ``Vagrant.has_plugin?("puppet")`` because Vagrant's built-in
# Puppet Provisioner provides a plugin named "puppet", so this always evaluates to true.
begin
gem "puppet"
rescue Gem::LoadError
raise "puppet is not installed in vagrant gems! please run 'vagrant plugin install puppet'"
end
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "puppetlabs/centos-7.0-64-puppet"
config.vm.hostname = "devbox-vagrant.domain.com"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine.
config.vm.network "forwarded_port", guest: 80, host: 8084
# Create a private network, which allows host-only access to the machine
config.vm.network "private_network", ip: "192.168.33.10"
# Share an additional folder to the guest VM. The first argument is
config.vm.synced_folder "c:/vagrant/share", "/vagrant_data"
#r10k config
config.r10k.puppet_dir = 'environments/dev' # the parent directory that contains your module directory and Puppetfile
config.r10k.puppetfile_path = 'environments/dev/Puppetfile' # the path to your Puppetfile, within the repo
config.r10k.module_path = 'environments/dev/modules'
#puppet config
config.vm.provision "puppet" do |puppet|
puppet.environment_path = "environments"
puppet.environment = "dev"
puppet.hiera_config_path = "hiera.yaml"
puppet.working_directory = "/tmp/vagrant-puppet"
end
end
↧