-- mode: markdown; mode: visual-line; --
Configure and manage Bourne Again SHell (Bash) dotfiles and profiles
Copyright (c) 2019 UL HPC Team <hpc-sysadmins@uni.lu>
| Project Page | Sources | Documentation | Issues |
Configure and manage Bourne Again SHell (Bash) dotfiles and profile. Bourne Again SHell (Bash) is the GNU Project's shell. Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). It is intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers functional improvements over sh for both programming and interactive use. In addition, most sh scripts can be run by Bash without modification..
This module implements the following elements:
-
Puppet classes:
bash
bash::common
bash::common::debian
: specific implementation under Debianbash::common::redhat
: specific implementation under Redhat-like systembash::params
: module parameters
-
Puppet definitions:
bash::setup
bash::config
All these components are configured through a set of variables you will find in
manifests/params.pp
.
Note: the various operations that can be conducted from this repository are piloted from a Rakefile
and assumes you have a running Ruby installation.
See docs/contributing.md
for more details on the steps you shall follow to have this Rakefile
working properly.
See metadata.json
. In particular, this module depends on
This is the main class defined in this module. It accepts the following parameters:
$ensure
: default to 'present', can be 'absent'$aliases
: Hash of key / command values to place in a aliases files$aliases_file
: configuration file where the aliases are placed.- Default:
/etc/profiles.d/bash_aliases.sh
- Default:
$dotfiles_provider
: Type of dotfiles provider- Default:
git
- Default:
$dotfiles_src
: URL of the [Git] repository hosting the dotfiles. Note that it is expected that this dotfiles directory contains an installation scriptinstall.sh
at the root of the repository that accept the '--delete
' command.- Default: https://github.com/ULHPC/dotfiles.git.
$dotfiles_revision
: [git] branch / revision / tag to use.- Default:
master
- Default:
Use it as follows:
include ' bash'
See also tests/init.pp
The definition bash::setup
configures .bashrc
and many other dotfiles (.inputrc
, .vimrc
, .screenrc
, bash aliases etc. ) for a given user within a given home directory (hopefully his home directory) using specific configuration (see https://github.com/ULHPC/dotfiles).
To do that, it relies on an installation script named install.sh
available at the root of repository that accepts also the '--delete
' command-line option to remove / uninstall the dotfiles.
This definition accepts the following parameters:
$ensure
: default to 'present', can be 'absent'$path
: If the title of the resource is not the homedir to consider, use thepath
parameter to precise the homedir to setup$user
: User that run the setup. BEWARE that it SHALL be the owner of the home directory you're trying to setup!!!!bash::setup
does not make extra checks to detect it so pay attention to it.- Default:
root
- Default:
$group
: As above but for the group operating the commands. BEWARE again to use the appropriate group!- Default:
root
- Default:
Example:
include bash
bash::setup{ '/home/vagrant':
ensure => 'present',
user => 'vagrant',
group => 'vagrant',
}
See also tests/vagrant_setup.pp
or tests/vagrant_setup_absent.pp
Permit to define a global or local bash configuration.
- Global configurations are placed in
/etc/profile.d/<title>.bash
- Local configurations are placed in
<rootdir>/.bash[.before].d/<title.bash>
This definition accepts the following parameters:
$ensure
: default to 'present', can be 'absent'$content
: Specify the contents of thebash::config
entry as a string. Newlines, tabs, and spaces can be specified using the escaped syntax (e.g., \n for a newline)$source
: Copy a file as the content of thebash::config
entry$rootdir
: Specifies a root directory hosting the bash configuration file.- Set it to a homedir (and precise the
owner
andgroup
directives) to make the configuration local and placed in<rootdir>/.bash[.before].d/<title>.bash
- Set it to a homedir (and precise the
$owner
: specifies the owner of the destination file- Default:
root
- Default:
$group
: specifies a permissions group for the destination file.- Default:
root
- Default:
$mode
: Specifies the permissions mode of the destination file.- Default:
0644
- Default:
$before_hook
: specifies if the bash configuration should be placed as a before hook. Only valid if rootdir is set.- Default:
false
- Default:
$warn
: Specifies whether to add a header message at the top of the destination file. Valid options: the booleans 'true' and 'false', or a string to serve as the header.- Default:
false
- Default:
Example:
include bash
# Install in /etc/profile.d
bash::config{ 'modules':
ensure => 'present',
warn => true,
content => "# Environment Module Path
export MODULEPATH='$HOME/.local/easybuild/modules/all:/opt/apps/easybuild/modules/all:/opt/apps/default/modules/all:$HOME/privatemodules:$HOME/easybuild/modules/all'"
}
See also tests/config.pp
or tests/config_vagrant.pp
You can of course configure the bash module in your Puppetfile
to make it available with Librarian puppet or
r10k by adding the following entry:
# Modules from the Puppet Forge
mod "ULHPC/bash"
or, if you prefer to work on the git version:
mod "ULHPC/bash",
:git => 'https://github.com/ULHPC/puppet-bash',
:ref => 'production'
You can submit bug / issues / feature request using the ULHPC/bash Puppet Module Tracker.
If you want to contribute to the code, you shall be aware of the way this module is organized.
These elements are detailed on docs/contributing.md
.
You are more than welcome to contribute to its development by sending a pull request.
The best way to test this module in a non-intrusive way is to rely on Vagrant.
The Vagrantfile
at the root of the repository pilot the provisioning various vagrant boxes available on Vagrant cloud you can use to test this module.
See docs/vagrant.md
for more details.
Read the Docs aka RTFD hosts documentation for the open source community and the ULHPC/bash puppet module has its documentation (see the docs/
directly) hosted on readthedocs.
See docs/rtfd.md
for more details.
This project and the sources proposed within this repository are released under the terms of the Apache-2.0 licence.