Vagrant: puppet-apply provisioner cannot install puppet (enhance request)

Created on 3 Aug 2018  路  5Comments  路  Source: hashicorp/vagrant

Enhancement request. Install puppet agent. At some point, it used to install puppet agent, but doesn't seem to do this anymore, as per current docs.

Vagrant version

Vagrant 2.1.2

Host operating system

ProductName:    Mac OS X
ProductVersion: 10.13.5
BuildVersion:   17F77

Guest operating system

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:    16.04
Codename:   xenial

Vagrantfile

Vagrant.configure('2') do |config|
  config.vm.box = 'bento/ubuntu-16.04'
  config.vm.network 'forwarded_port', guest: 80, host: 8081
  config.vm.provision 'puppet'
end

Debug output

https://gist.github.com/darkn3rd/9eb6f98b77680b8ed49bd2ce2c8602c5

Expected behavior

Puppet would be installed and work.

Actual behavior

Puppet is not installed

Steps to reproduce

  1. vagrant up

```bash
mkdir manifests
cat <<<-MANIFEST > manifests/default.pp
class hello_puppet {
package { 'apache2':
ensure => present,
}
service { 'apache2':
ensure => running,
enable => true,
}
}
MANIFEST

enhancement needs-community-help provisionepuppet task-medium

Most helpful comment

That is why this is an enhancement request. This is an enhancement request to add the capability for installations.

All other provisioners have this capability, so puppet is the only one that does not have the ability to bootstrap the agent on the system.

All 5 comments

Does your machine have anything inside of /opt/puppetlabs/bin/puppet? Is puppet installed on your guest? According to the docs, Vagrant will not install Puppet and expects it to be installed on your guest for the Puppet Apply provisioner to work: https://www.vagrantup.com/docs/provisioning/puppet_apply.html#bare-minimum

Thanks!

That is why this is an enhancement request. This is an enhancement request to add the capability for installations.

All other provisioners have this capability, so puppet is the only one that does not have the ability to bootstrap the agent on the system.

#!/bin/sh
command -v puppet > /dev/null && { echo "Puppet is installed! skipping" ; exit 0; }

ID=$(cat /etc/os-release | awk -F= '/^ID=/{print $2}' | tr -d '"')
VERS=$(cat /etc/os-release | awk -F= '/^VERSION_ID=/{print $2}' | tr -d '"')

case "${ID}" in
  centos|rhel)
    wget https://yum.puppet.com/puppet5/puppet5-release-el-${VERS}.noarch.rpm
    rpm -Uvh puppet5-release-el-${VERS}.noarch.rpm
    yum install -y puppet-agent
    ;;
  fedora)
    rpm -Uvh https://yum.puppet.com/puppet5/puppet5-release-fedora-${VERS}.noarch.rpm
    yum install -y puppet-agent
    ;;
  debian|ubuntu)
    wget https://apt.puppetlabs.com/puppet5-release-$(lsb_release -cs).deb
    dpkg -i puppet5-release-$(lsb_release -cs).deb
    apt-get -qq update
    apt-get install -y puppet-agent
    ;;
  *)
    echo "Distro '${ID}' not supported" 2>&1
    exit 1
    ;;
esac

Thanks for the script! However I am expecting the actual implementation to be a lot more complex than this. We'll need windows support (and other guests that puppet agents can run on), the ability to configure which version of puppet you are installing (to support older modules), and unit tests. Probably more that I am forgetting? An example of this pattern would be the docker provisioner, which has a similar architecture within vagrant as a provisioner. I'm writing this all up now as a starting point for future reference for anyone who decides to pick up this task.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DreadPirateShawn picture DreadPirateShawn  路  3Comments

mpontillo picture mpontillo  路  3Comments

rhencke picture rhencke  路  3Comments

jazzfog picture jazzfog  路  3Comments

Cbeck527 picture Cbeck527  路  3Comments