Forge Home


Puppet module for creating chroot environments


22,461 latest version

4.6 quality score

Version information

  • 0.2.0 (latest)
  • 0.1.1
  • 0.1.0 (deleted)
released Aug 14th 2015
This version is compatible with:
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'maxhope-chroot', '0.2.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add maxhope-chroot
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install maxhope-chroot --version 0.2.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.



maxhope/chroot — version 0.2.0 Aug 14th 2015


Table of Contents

  1. Overview
  2. Module Description
  3. Setupt
  4. Usage
  5. Reference
  6. Limitations
  7. Development


Create and run executables in chroot environments.

Module Description

This module setups and run executables in chroot environments.


What chroot affects

  • chroot will create the file /tmp/ that setups the chroot environment

Beginning with chroot

I strongly recommend you to read about the chroot command. Type 'man chroot' in you terminal.


You can create a chroot environment by calling the chroot class:

class {'::chroot': 
  $ensure     = present,
  $path       = '/opt/mychroot',
  $contents   = ['/bin', '/usr/bin','/usr/lib', '/usr/lib64', '/etc', '/dev', '/lib', '/lib64'],
  $copy       = ['/etc/group', '/etc/passwd', '/etc/resolv.conf', '/etc/hosts'],
  $exec       = '/usr/bin/cat',
  $userspec   = 'root:root',
  $groups     = '',

This will create a complete chroot environment and create all folders and files specified by you and also copy you executables´dependencies into the chroot environment.

If you already have a complete chroot environment, then you can use the chroot type:

chroot {'mychroot':
   ensure     => present,
   path       => /path/to/chroot,
   userspec   => 'root:root',
   groups     => '',
   exec       => '/usr/bin/cat',

Class parameters

  • ensure
    Setup or uninstall the chroot environment. Accepted values: [present | absent]
  • path
    The path to your chroot environment. Ex: /opt/mychroot
  • contents
    The folders to be created in your chroot environment. Accepted value: string array. Ex: ['/bin', '/usr/bin','/usr/lib', '/etc', '/dev', '/lib']
  • copy
    The files to be copied to your chroot environment. Accepted value: string array. Ex: ['/etc/group', '/etc/passwd', '/etc/resolv.conf', '/etc/hosts'],
  • exec
    The path to the executable to be run in the chroot environment. Ex:'/usr/bin/bash'
  • userspec
    The userspec to be used when running the chroot environment. Ex: 'root:root',
  • groups
    The additional groups to be used when running the executable in the chroot environment. Accepted value: string array. Ex: ['wheel']


Puppet 3.7 or above is recommended.


Check the github repos for the code and there you can request for merges if you have maked any improvements.