Merge pull request #396 from NeatNerdPrime/puppet_update_stretch

Stretch update commit
This commit is contained in:
Anders Ingemann 2017-09-03 15:49:49 +02:00 committed by GitHub
commit 56b95924de
4 changed files with 81 additions and 10 deletions

View file

@ -7,8 +7,8 @@ manifest inside the chroot. You can also have it copy your puppet
configuration into the image so it is readily available once the image
is booted.
Rationale and use case
~~~~~~~~~~~~~~~~~~~~~~
Rationale and use case in a masterless setup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You want to use this plugin when you wish to create an image and to be able to
manage that image with Puppet. You have a Puppet 4 setup in mind and thus you
@ -18,8 +18,33 @@ This plugin does just that!
While you're at it, throw in some modules from the forge as well!
Want to include your own modules? Include them as assets!
For now this plugin is only compatible with Debian versions Wheezy and Jessie.
These are also the distributions supported by puppetlabs.
This is primarily useful when you have a very limited collection of nodes you
wish to manage with puppet without to having to set up an entire puppet infra-
structure. This allows you thus to work "masterless".
You can use this to bootstrap any kind of appliance, like a puppet master!
For now this plugin is only compatible with Debian versions Wheezy, Jessie and
Stretch. These are Debian distributions supported by puppetlabs.
About Master/agent setups
~~~~~~~~~~~~~~~~~~~~~~~~~
If you wish to use this plugin in an infrastructure where a puppet master is
present, you should evaluate what your setup is. In a puppet OSS server setup
it can be useful to just use the plugin without any manifests, assets or
modules included.
In a puppet PE environment you will probably not need this plugin since the PE
server console gives you an URL that installs the agent corresponding to your
PE server.
About Puppet 5
~~~~~~~~~~~~~~
Although Puppet 5 is available for some time, there is still heavy development
going on in that version. This module does NOT support the installation of this
version at this time. If you think this should be the case, please open up an
issue on `<https://github.com/NeatNerdPrime/bootstrap-vz/>`.
Settings
~~~~~~~~
@ -49,10 +74,6 @@ General:
- This plugin only installs the PC1 package for now, needs to be extended to
be able to install the package of choice
- The puppetlabs agent is only available to i386 and amd64 architectures. ARM
is not available from repository at this time. If you need to have the agent
on ARM, you need to build the agent yourself, and install them through the
``packages`` section of the bootstrap-vz manifest
Manifests:

View file

@ -3,11 +3,12 @@ from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
from bootstrapvz.common.exceptions import TaskError
from bootstrapvz.common.releases import jessie, wheezy
from bootstrapvz.common.releases import jessie, wheezy, stretch
from bootstrapvz.common.tools import sed_i, log_check_call, rel_path
from __builtin__ import str
ASSETS_DIR_STRETCH = rel_path(__file__, 'assets/gpg-keyrings-PC1/stretch')
ASSETS_DIR_JESSIE = rel_path(__file__, 'assets/gpg-keyrings-PC1/jessie')
ASSETS_DIR_WHEEZY = rel_path(__file__, 'assets/gpg-keyrings-PC1/wheezy')
@ -19,7 +20,7 @@ class CheckRequestedDebianRelease(Task):
@classmethod
def run(cls, info):
from bootstrapvz.common.exceptions import TaskError
if not info.manifest.release == (jessie or wheezy):
if info.manifest.release not in (jessie, wheezy, stretch):
msg = 'Debian {info.manifest.release} is not (yet) available in the Puppetlabs.com APT repository.'
raise TaskError(msg)
@ -65,6 +66,8 @@ class InstallPuppetlabsPC1ReleaseKey(Task):
@classmethod
def run(cls, info):
from shutil import copy
if (info.manifest.release == stretch):
key_path = os.path.join(ASSETS_DIR_STRETCH, 'puppetlabs-pc1-keyring.gpg')
if (info.manifest.release == jessie):
key_path = os.path.join(ASSETS_DIR_JESSIE, 'puppetlabs-pc1-keyring.gpg')
if (info.manifest.release == wheezy):
@ -79,6 +82,8 @@ class AddPuppetlabsPC1SourcesList(Task):
@classmethod
def run(cls, info):
if (info.manifest.release == stretch):
info.source_lists.add('puppetlabs', 'deb http://apt.puppetlabs.com stretch PC1')
if (info.manifest.release == jessie):
info.source_lists.add('puppetlabs', 'deb http://apt.puppetlabs.com jessie PC1')
if (info.manifest.release == wheezy):

View file

@ -0,0 +1,45 @@
---
name: debian-{system.release}-{system.architecture}-{%Y}{%m}{%d}
provider:
name: kvm
virtio_modules:
- virtio_pci
- virtio_blk
bootstrapper:
workspace: /target
system:
release: stretch
architecture: amd64
bootloader: grub
charmap: UTF-8
locale: en_US
timezone: UTC
volume:
backing: raw
partitions:
type: msdos
root:
filesystem: ext4
size: 10GiB
packages:
install_standard: true
mirror: http://httpredir.debian.org/debian
install:
# required to be pre-installed for proper puppet functioning of
# puppetlabs-apt, it is also the primary puppet module
- lsb-release
plugins:
# It is advisable to avoid running things as root, use a sudo account instead
admin_user:
username: administrator
password: something
# puppet plugin
puppet:
# The assets path MUST be ABSOLUTE on your project.
assets: /your/absolute/path/to/etc/puppetlabs
install_modules:
- [puppetlabs-accounts]
- [puppetlabs-apt]
- [puppetlabs-concat, 3.0.0]
- [puppetlabs-stdlib]
- [puppetlabs-apache, 1.11.0]