Skip to content

Commit

Permalink
Added support for puppet_collections
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Graf committed Jul 31, 2015
1 parent 11a2df7 commit 9799834
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ endif

PACKER ?= packer

# Possible values for CM: (nocm | chef | chefdk | salt | puppet)
# Possible values for CM: (nocm | chef | chefdk | salt | puppet | puppet_collections)
CM ?= nocm
# Possible values for CM_VERSION: (latest | x.y.z | x.y)
CM_VERSION ?=
Expand All @@ -32,6 +32,10 @@ PACKER_VARS_LIST = 'cm=$(CM)' 'headless=$(HEADLESS)' 'update=$(UPDATE)' 'version
ifdef CM_VERSION
PACKER_VARS_LIST += 'cm_version=$(CM_VERSION)'
endif
ifdef CM_PC_VERSION
PACKER_VARS_LIST += 'cm_pc_version=$(CM_PC_VERSION)'
endif

PACKER_VARS := $(addprefix -var , $(PACKER_VARS_LIST))

ifdef PACKER_DEBUG
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,15 @@ Possible values for the CM variable are:
* `nocm` - No configuration management tool
* `chef` - Install Chef
* `puppet` - Install Puppet
* `puppet_collections` - Install a Puppet Collection
* `salt` - Install Salt

You can also specify a variable `CM_VERSION`, if supported by the
configuration management tool, to override the default of `latest`.
The value of `CM_VERSION` should have the form `x.y` or `x.y.z`,
such as `CM_VERSION := 11.12.4`
Using Puppet Collections, you can specify the Puppet Collection version
via `CM_PC_VERSION`, such as `CM_PC_VERSION := pc1`

The variable `HEADLESS` can be set to run Packer in headless mode.
Set `HEADLESS := true`, the default is false.
Expand Down
2 changes: 2 additions & 0 deletions debian6010-i386.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -162,6 +163,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian6010.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PATH={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -162,6 +163,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian75-i386.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -147,6 +148,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian75.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -147,6 +148,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian76-i386.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -145,6 +146,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian76.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -147,6 +148,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian77-i386.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -145,6 +146,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian77.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -147,6 +148,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian78-i386.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -165,6 +166,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian78.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -167,6 +168,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian80-i386.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -165,6 +166,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian80.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -167,6 +168,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian81-i386.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -165,6 +166,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
2 changes: 2 additions & 0 deletions debian81.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CM_PC_VERSION={{user `cm_pc_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
Expand Down Expand Up @@ -167,6 +168,7 @@
"cleanup_pause": "",
"cm": "nocm",
"cm_version": "",
"cm_pc_version": "",
"disk_size": "40000",
"ftp_proxy": "{{env `ftp_proxy`}}",
"headless": "",
Expand Down
23 changes: 23 additions & 0 deletions script/cmtool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# 'chefdk' -- build a box with Chef Development Kit
# 'salt' -- build a box with Salt
# 'puppet' -- build a box with Puppet
# 'puppet_collections' -- build a box with Puppet Collections
#
# Values for CM_VERSION can be (when CM is chef|chefdk|salt|puppet):
# 'x.y.z' -- build a box with version x.y.z of Chef
Expand Down Expand Up @@ -81,6 +82,24 @@ install_puppet()
rm -f ${DEB_NAME}
}

install_puppet_collections()
{
echo "==> Installing Puppet Collections ${CM_PC_VERSION}"
DEB_RELEASE=$(/usr/bin/lsb_release -cs)
DEB_NAME="puppetlabs-release-${CM_PC_VERSION}-${DEB_RELEASE}.deb"
wget http://apt.puppetlabs.com/${DEB_NAME}
dpkg -i ${DEB_NAME}
apt-get update
if [[ ${CM_VERSION:-} == 'latest' ]]; then
echo "==> Installing latest puppet-agent version"
apt-get install -y puppet-agent
else
echo "==> Installing puppet-agent version $CM_VERSION"
apt-get install -y puppet-agent=$CM_VERSION$DEB_RELEASE
fi

rm -f ${DEB_NAME}
}
#
# Main script
#
Expand All @@ -102,6 +121,10 @@ case "${CM}" in
install_puppet
;;

'puppet_collections')
install_puppet_collections
;;

*)
echo "==> Building box without baking in a configuration management tool"
;;
Expand Down

0 comments on commit 9799834

Please sign in to comment.