Puppet FreeBSD Workstation
Puppet script for provisioning my FreeBSD desktop workstation.
Table of Contents
Setup
First, you need to get the latest source code by cloning the git repository with this command.
git clone https://github.com/lognoz/puppet-freebsd-workstation.git
Finally, change to the directory that was just created.
cd puppet-freebsd-workstation
Prerequisites
You must be run as root and have an internet connection. You can install the dependencies with this command line:
make dependencies
System dependencies
git
Distributed source code management tool
puppet7
Configuration management framework written in Ruby
Puppet dependencies
puppet-archive
Compressed archive file download and extraction with native types/providers for Windows and Unix
puppet-nodejs
Install Node.js package and npm package provider.
puppet-php
Generic PHP module that supports many platforms
puppetlabs-apache
Installs, configures, and manages Apache virtual hosts, web services, and modules.
puppetlabs-mysql
Installs, configures, and manages the MySQL service.
puppetlabs-stdlib
Standard library of resources for Puppet modules.
puppetlabs-vcsrepo
Puppet module providing a type to manage repositories from various version control systems
rehan-wget
Install, manage and configure wget and retrieve files using it
saz-sudo
Manage sudo configuration via Puppet
saz-timezone
Manage timezone settings via Puppet
Usage
Create your own site.pp
at base path:
touch site.pp
You can read example.pp
located to base path to help building your own site node.
Add to your file the user that will lead your workstation:
class { 'workstation':
username => 'john',
owner_name => 'John Doe',
owner_email => 'developer@john-doe.org',
timezone => 'America/New_York',
password => 'default'
}
Finally, apply your site file by executing this command. Be carful this will replace directory
located at /usr/local/etc/puppet/modules/workstation/
.
make
Manifests
List of available manifests
- workstation
- workstation::alsamixer
- workstation::bash::alias
- workstation::bash::bin
- workstation::bash::init
- workstation::bash::rc
- workstation::doas
- workstation::fonts
- workstation::gnu
- workstation::graphic
- workstation::keyboard
- workstation::language
- workstation::multimedia::firefox
- workstation::multimedia::graphic
- workstation::multimedia::torrent
- workstation::multimedia::wget
- workstation::multimedia::youtube_dl
- workstation::optimization
- workstation::package
- workstation::powerd
- workstation::programming::hacking
- workstation::programming::latex
- workstation::programming::lisp::clisp
- workstation::programming::python
- workstation::programming::virtualisation
- workstation::programming::www::apache
- workstation::programming::www::mysql
- workstation::programming::www::npm
- workstation::programming::www::php
- workstation::security
- workstation::sudo
- workstation::system
- workstation::tor
- workstation::user::directories
- workstation::user::emacs
- workstation::user::git
- workstation::user::vim
- workstation::x11::conf
- workstation::x11::dwm
- workstation::x11::xorg
workstation
This class sets root and user for FreeBSD systems. Make sure to load
this file before any workstation subclasses.
Show detail
Variables:
username
— Type: string — Default: undef
String used to create user and its home directory.
password
— Type: string — Default: undef
String used as user and root password.
timezone
— Type: string — Default: undef
String used as timezone reference.
owner_name
— Type: string — Default: undef
String used as computer owner name.
owner_email
— Type: string — Default: undef
String used as computer owner email.
shell
— Type: string|undef — Default: undef
String used as command processor path. If you use zsh on FreeBSD,
you will send /usr/bin/zsh. By default, this class will install
and use bash if $shell is undefined.
root
— Type: string — Default: /usr/local/etc/puppet/modules/workstation/
The reference on where the workstation module is located.
Sample Usage:
class { 'workstation':
username => 'lognoz',
owner_name => 'Marc-Antoine Loignon',
owner_email => 'developer@lognoz.org',
timezone => 'America/New_York',
password => $password
}
workstation::alsamixer
This class initialize alsamixer package. This program is a graphical
mixer program for the Advanced Linux Sound Architecture that is used
to configure sound settings and adjust the volume.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::alsamixer
workstation::bash::alias
This module manages bash aliases configurations.
Show detail
Variables:
content
— Type: string|array — Default: $title
Content of configuration to append.
Requires:
Class workstation
Sample Usage:
workstation::bash::alias { [
'ls="ls -F"',
'll="ls -lah"',
'emacs="emacs --maximized"'
]: }
workstation::bash::bin
This module manages bash executable.
Show detail
Variables:
content
— Type: string — Default: undef
Script content in file.
Requires:
Class workstation
Sample Usage:
workstation::bash::bin { 'torrent':
content => template('workstation/bin/torrent.erb')
}
workstation::bash::init
This class install bash and some useful configurations.
Show detail
Variables:
files
— Type: array — Default: []
List of files related to bash that need to be created.
Requires:
Class workstation
Sample Usage:
include workstation::bash::init
workstation::bash::rc
This module manages bashrc configurations.
Show detail
Variables:
content
— Type: string|array — Default: $title
Content of configuration to append.
Requires:
Class workstation
Sample Usage:
workstation::bash::rc {
'alias ls="ls -F"':
}
workstation::doas
This class sets doas package. This program allows a regular user to
run commands as another user (usually root).
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::doas
workstation::fonts
This class install system fonts.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::fonts
workstation::gnu
This class install GNU utils and libraries like gmake, ripgrep,
gls, gcc, etc.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::gnu
workstation::graphic
This class add graphics support to make FreeBSD usable as a desktop.
It only supports Intel HD and NVIDIA graphics cards.
Show detail
Variables:
hardware
— Type: string — Default: undef
String used to install the right graphic card.
It expected to recives intel or nvidia.
Requires:
Class workstation
Sample Usage:
class { 'workstation::graphic':
hardware => 'nvidia'
}
workstation::keyboard
This class sets keyboard in xorg. For each input device (keyboard,
mouse, etc.) it need an InputClass section.
Show detail
Variables:
keyboard
— Type: string — Default: undef
String used as kbd layout.
remap_caps
— Type: boolean — Default: true
Boolean on if caps lock is replaced by escape.
Requires:
Class workstation::x11::xorg
Sample Usage:
class { 'workstation::keyboard':
keyboard => 'us,ca'
}
workstation::language
This class help to manage multiple languages keyboard and language
tool program.
Show detail
Variables:
aspell
— Type: string — Default: undef
Array of languages to install via Freebsd ports. Make sure
to have the right package name before to call this class.
directory
— Type: string — Default: ~/.share
The location on where to install Language Tool package.
Requires:
Class workstation
Sample Usage:
class { 'workstation::language':
aspell => ['en','fr']
}
workstation::multimedia::firefox
This class initialize Firefox package. This program, also known as
Mozilla Firefox, is a free and open-source web browser developed by
the Mozilla Foundation and its subsidiary, the Mozilla Corporation.
Show detail
Variables:
extensions
— Type: array — Default: []
List of extensions that you want to install in Firefox.
Requires:
Class workstation
Sample Usage:
class { 'workstation::multimedia::firefox':
extensions => [
'3679754/ublock_origin-1.31.0-an+fx.xpi',
'3679479/https_everywhere-2020.11.17-an+fx.xpi',
'3690660/user_agent_switcher-1.4.1-an+fx.xpi',
'3672658/decentraleyes-2.0.15-an+fx.xpi',
'3682334/clearurls-1.20.0-an+fx.xpi',
'3691752/noscript_security_suite-11.1.6-an+fx.xpi',
'3724574/grammatik_und_rechtschreibprufung_languagetool-3.3.4-fx.xpi'
]
}
workstation::multimedia::graphic
This class install Gimp, Blender, VLC and others useful
graphic tools.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::multimedia:graphic
workstation::multimedia::torrent
This class initialize transmission package. This program is a lightweight,
command-line BitTorrent client with scripting capabilities.
Show detail
Variables:
destination
— Type: string — Default: download
String used as destination directory for torrent file.
source
— Type: string — Default: download
String used as source directory for torrent file.
Requires:
Class workstation
Sample Usage:
class { 'workstation::multimedia::torrent':
destination => 'download/torrent',
source => 'download/browser'
}
workstation::multimedia::wget
This initialize wget package. This computer program that retrieves
content from web servers.
Show detail
Variables:
directory
— Type: string — Default: download
String used as download directory for torrent file.
Requires:
Class workstation
Sample Usage:
class { 'workstation::multimedia::wget':
directory => 'download/wget'
}
workstation::multimedia::youtube_dl
This class initialize youtube-dl package. This program is an
open-source download manager for video and audio from YouTube and
over 1000 other video hosting websites.
Show detail
Variables:
directory
— Type: string — Default: video
String used as download directory for torrent file.
Requires:
Class workstation
Sample Usage:
class { 'workstation::multimedia::youtube_dl':
directory => 'video/youtube'
}
workstation::optimization
This class install some programs and change system configurations to
make FreeBSD usable as a desktop station.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::optimization
workstation::package
This class sets FreeBSD package configurations.
Show detail
Variables:
prefer_yes
— Type: boolean — Default: true
Boolean used to make yes option the default operations
for dialog. Most pkg operations offer a yes/no
question, showing the default as a capital letter.
Being conservative, pkg normally defaults to no.
autoclean
— Type: boolean — Default: true
Boolean used to automatically clean out the content of
pkg cache after each non dry-run call to pkg install
or pkg upgrade.
Requires:
Class workstation
Sample Usage:
include workstation::package
workstation::powerd
This class initialize powerd package. This program utility monitors
the system state and sets various power control options accordingly.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::powerd
workstation::programming::hacking
This class install most useful hacking tools.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::programming::hacking
workstation::programming::latex
This class initialize LaTeX programming language.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::programming::latex
workstation::programming::lisp::clisp
This class initialize Common Lisp programming language.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::programming::lisp::clisp
workstation::programming::python
This class initialize Python programming language.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::programming::python
workstation::programming::virtualisation
This class initialize virtualisation program like Vagrant,
Docker and Virtualbox.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::programming:virtualisation
workstation::programming::www::apache
This class initialize Apache server.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::programming::www:apache
workstation::programming::www::mysql
This class initialize MySQL database server.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::programming::www:mysql
workstation::programming::www::npm
This class initialize npm package. This program is a package manager
for the JavaScript programming language.
Show detail
Variables:
packages
— Type: array — Default: undef
List of packages to be install globally.
Requires:
Class workstation
Sample Usage:
include workstation::programming::www:npm
workstation::programming::www::php
This class initialize PHP programming language.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::programming::www:php
workstation::security
This class install improve the system security.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::security
workstation::sudo
This class initialize sudo package. This program is designed to
allow a sysadmin to give limited root privileges to users and log
root activity.
Show detail
Requires:
Class workstation
Vulnerability:
I now use doas instead of sudo because a severe vulnerability was
found in Unix and Linux operating systems that allows an
unprivileged user to exploit this vulnerability using sudo, causing
a heap overflow to elevate privileges to root without
authentication, or even get listed in the sudoers
file. (CVE-2021-3156)
Sample Usage:
include workstation::sudo
workstation::system
This module manages system configurations.
Show detail
Variables:
path
— Type: string — Default: undef
String use as path location to add content.
content
— Type: array — Default: undef
List of lines to add to the path location.
Requires:
Class workstation
Sample Usage:
workstation::system { 'Optimize boot loader':
path => '/boot/loader.conf',
content => [
# Change boot time kernel tuning.
'kern.ipc.shmseg = 1024',
'kern.ipc.shmmni = 1024',
'kern.maxproc = 100000',
# Configuring asynchronous I/O.
'aio_load = "YES"',
# Enable thermal sensors.
'coretemp_load="YES"'
]
}
workstation::tor
This class initialize tor, a software for enabling anonymous
communication by directing Internet traffic.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::tor
workstation::user::directories
This class manages custom directories and xdg-user-dirs, a tool to
help manage well known user directories like the desktop folder and
the music folder.
Show detail
Variables:
desktop
— Type: string — Default: /
The desktop user directory
document
— Type: string — Default: /document
The document user directory
download
— Type: string — Default: /download
The download user directory
music
— Type: string — Default: /music
The music user directory
picture
— Type: string — Default: /picture
The picture user directory
public
— Type: string — Default: /public
The public user directory
template
— Type: string — Default: /template
The template user directory
video
— Type: string — Default: /video
The video user directory
directories
— Type: array — Default: []
The list of directories that need to be created
Requires:
Class workstation
Sample Usage:
class { 'workstation::user::directories':
download => '/download/browser',
directories => [
'/download',
'/document',
'/program',
'/video'
]
}
workstation::user::emacs
This class initialize Emacs package. This program is a highly
customizable editor indeed, it has been customized to the point
where it is more like an operating system than an editor!
Show detail
Variables:
source
— Type: string — Default: undef
The git repository of Emacs configuration.
Requires:
Class workstation
Sample Usage:
class { 'workstation::user::emacs':
source => 'https://github.com/lognoz/embla'
}
workstation::user::git
This class initialize git package. This program is a distributed
version-control system for tracking changes in source code during
software development.
Show detail
Variables:
username
— Type: string — Default: undef
Content of git user name.
email
— Type: string — Default: undef
Content of git user email.
url
— Type: hash|undef — Default: undef
Hash of git url to be rewritten.
Requires:
Class workstation
Sample Usage:
class { 'workstation::user::git':
username => 'Marc-Antoine Loignon',
email => 'developer@lognoz.org'
urls => {
'https://lognoz@github.com' => 'https://github.com',
}
}
workstation::user::vim
This class initialize Vim package. This program is a highly
configurable text editor built to make creating and changing any
kind of text very efficient.
Show detail
Variables:
source
— Type: string — Default: undef
The git repository of vim configuration.
Requires:
Class workstation
Sample Usage:
class { 'workstation::user::vim':
source => 'https://github.com/lognoz/vimrc'
}
workstation::x11::conf
This module manages Xorg configurations.
Show detail
Variables:
content
— Type: string|array — Default: $title
Content of configuration to append to xinitrc.
Requires:
Class workstation
Sample Usage:
workstation::x11::conf {
'xmodmap ~/.Xmodmap':
}
workstation::x11::dwm
This module manages Dynamic Windows Manager installation.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::x11:dwm
workstation::x11::xorg
This class sets xorg package. Xorg (commonly referred as simply X)
is the most popular display server among Linux and BSD users.
Show detail
Requires:
Class workstation
Sample Usage:
include workstation::x11::xorg
Limitations
This module is only usable with FreeBSD 13.0.