Forge Home

bash

Configure and manage Bourne Again SHell (Bash) dotfiles and profiles

12,395 downloads

7,254 latest version

4.6 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.7.6 (latest)
  • 0.7.5
  • 0.7.4
  • 0.7.3
  • 0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.3
  • 0.6.2
  • 0.6.1
  • 0.6.0
  • 0.5.2
released May 16th 2017
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 'ULHPC-bash', '0.7.6'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add ULHPC-bash
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install ULHPC-bash --version 0.7.6

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.

Download
Tags: shell, bash, gnu

Documentation

ULHPC/bash — version 0.7.6 May 16th 2017

-- mode: markdown; mode: visual-line; --

Bash Puppet Module

Puppet Forge License Supported Platforms Documentation Status

Configure and manage Bourne Again SHell (Bash) dotfiles and profiles

  Copyright (c) 2016 S. Varrette, H. Cartiaux, V. Plugaru, S. Diehl, C. Parisot aka. UL HPC Management Team <hpc-sysadmins@uni.lu>

| Project Page | Sources | Documentation | Issues |

Synopsis

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 Debian
    • bash::common::redhat: specific implementation under Redhat-like system
    • bash::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.

Dependencies

See metadata.json. In particular, this module depends on

Overview and Usage

Class bash

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
  • $dotfiles_provider: Type of dotfiles provider
    • Default: git
  • $dotfiles_src: URL of the [Git] repository hosting the dotfiles. Note that it is expected that this dotfiles directory contains an installation script install.sh at the root of the repository that accept the '--delete' command.
  • $dotfiles_revision: [git] branch / revision / tag to use.
    • Default: master

Use it as follows:

 include ' bash'

See also tests/init.pp

Definition bash::setup

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 the path 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
  • $group: As above but for the group operating the commands. BEWARE again to use the appropriate group!
    • Default: root

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

Definition bash::config

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 the bash::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 the bash::config entry
  • $rootdir: Specifies a root directory hosting the bash configuration file.
    • Set it to a homedir (and precise the owner and group directives) to make the configuration local and placed in <rootdir>/.bash[.before].d/<title>.bash
  • $owner: specifies the owner of the destination file
    • Default: root
  • $group: specifies a permissions group for the destination file.
    • Default: root
  • $mode: Specifies the permissions mode of the destination file.
    • Default: 0644
  • $before_hook: specifies if the bash configuration should be placed as a before hook. Only valid if rootdir is set.
    • Default: false
  • $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

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

Librarian-Puppet / R10K Setup

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'

Issues / Feature request

You can submit bug / issues / feature request using the ULHPC/bash Puppet Module Tracker.

Developments / Contributing to the code

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.

Puppet modules tests within a Vagrant box

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.

Online Documentation

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.

Licence

This project and the sources proposed within this repository are released under the terms of the Apache-2.0 licence.

Licence