Cdist Explained

cdist
Author:Nico Schottelius, Steven Armstrong
Latest Release Version:6.9.8
Latest Release Date:[1]
Programming Language:Python, Bourne shell
Operating System:Linux, Unix-like, macOS[2]
Genre:Software configuration management
License:GNU General Public License version 3 or later

cdist is a free software configuration management tool for Unix-like systems. It managesnodes over SSH using the Bourne Shell, and does not require any additional software to be installed on target nodes.

Cdist differentiates itself from competing configuration management systems by choosing the Bourne Shell as the primary language for writing configuration scripts and requiring effectively no dependencies on target nodes. Although cdist's core is written in Python, an interpreter is only required on the host machine, not target nodes.

Cdist was forked in August 2022 as skonfig.[3]

Development

cdist development started in 2010 at ETH Zurich andis actively being developed[4] and is maintained primarily by Nico Schottelius andSteven Armstrong.[5] cdist is being used at various companies in Switzerland (such as ETH Zurich[6] and The OMA Browser project),[7] the US, Germany and France.

Features

cdist is a zero dependency configuration management system: It requires only ssh and a bourne-compatible shell on target hosts, which are provided by default on most Unix-like machines. Because of this, cdist can be used to bootstrap other configuration management systems.[8]

Installation and configuration

cdist is not typically installed as a package (like .deb or .rpm), but rather via git.All commands are run from the created checkout.The entry point for any configuration is the shell script conf/manifest/init, which is called initial manifest in cdist terms.

The main components of cdist are so called types, which bundle functionality.[9] The types essentially consists of a number of shell scripts to define which types a typereuses and which code is generated to be executed on the target host.

Architecture

cdist is split into two components:

Core

Cdist's core handles reading configuration and communicating with remote hosts. Like Ansible, cdist uses a "push" model to apply configuration changes: A cdist process on the "host" machine connects to any number of remote nodes via SSH and then performs configuration updates on those nodes. Cdist can configure multiple hosts in parallel to reduce the time spent configuring.

Configuration

The configuration scripts define how the targets shall be configured. They are typically written in Bourne Shell and consists of

Shell is the de facto language for writing cdist configuration scripts, but most of the scripts can be written in any language if they contain a suitable shebang line. Shell scripting is favored because of how simple it is to access environment variables, read files, and execute system commands.

Configuration language

All user configurable parts are contained in manifests or gencode-scripts, which are shell scripts.Shell scripts were chosen, because Unix System Administrators are usually proficient in readingand writing shell scripts. Furthermore, shell is also commonly available on potential target systems,thus avoiding the need to install additional software there ("zero dependencies").

cdist reads its configuration from the initial manifest (conf/manifest/init), in which hosts are mapped totypes:

case "$__target_host" in myhostname) __package zsh --state present __addifnosuchline /tmp/cdist-welcome --line "Welcome to cdist" ;;esac

When using the types in cdist, they are called like normal programs in manifests and can make use ofadvanced parameter parsing as well as reading from stdin:

  1. Provide a default file, but let the user change it

__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \ --state exists \ --owner frodo --mode 0600

  1. Take file content from stdin

__file /tmp/whatever --owner root --group root --mode 644 --source - << DONEHere goes the content for /tmp/whateverDONE

Dependencies are expressed by setting up the require environment variable:

      __directory /tmp/foobar
      require="__directory//tmp/foobar" __file /tmp/foobar/baz

Access to paths and files within types is given by environment variables like .

Similar software

Ansible, like cdist, uses an agentless push model to configure nodes. However, Ansible requires Python for some types of targets, whereas cdist does not. Ansible makes a distinction between roles, written in a declarative YAML-based language, and modules, written in Python. Cdist only has "types" which serve the purposes of both modules and roles and are mostly written in Bourne Shell. Cdist's approach might be preferable because Shell is familiar to many system administrators who have never used a configuration management system before, but Ansible's declarative language is arguably more readable and appropriate.

External links

Notes and References

  1. Web site: Tags - cdist - Gitea: Git with a cup of tea . code.ungleich.ch . 2022-01-15.
  2. Web site: 3. Supported operating systems — cdist 6.9.8 documentation . cdi.st . 2022-01-15.
  3. Web site: .github/README.md at df2f84b694afee8137b97695f6424c5aec314717 · skonfig/.github . GitHub.com.
  4. http://cia.vc/stats/project/cdist
  5. Web site: ungleich/cdist: cdist configuration management . GitHub.com . 2016-04-10 . https://web.archive.org/web/20150705072143/https://github.com/telmich/cdist . 2015-07-05 . live .
  6. Web site: Cdist configuration management . 2012-06-08 . dead . https://archive.today/20130115205250/http://sans.ethz.ch/projects/cdist/ . 2013-01-15 .
  7. Web site: About the OMA Browser . June 26, 2012 . dead . https://web.archive.org/web/20120817101530/http://omabrowser.org/about.html . August 17, 2012 .
  8. Web site: Google Groups . Groups.google.com . 2016-04-10.
  9. Web site: cdist-type(7) . Nico.schottelius.org . 2016-04-10 . dead . https://web.archive.org/web/20160303233448/http://www.nico.schottelius.org/software/cdist/man/latest/man7/cdist-type.html . 2016-03-03 .
  10. Web site: 13. Manifest — cdist 4.10.6-6-g61ac4a26 documentation. www.nico.schottelius.org. 2019-03-26.