Cdist

{{Short description|Software configuration management tool}}

{{Multiple issues|

{{Notability|Products|date=June 2012}}

{{More citations needed|date=June 2012}}

{{Technical|date=June 2012}}}}

{{lowercase title}}

{{Infobox software

|name = cdist

|logo = Cdist_logo.svg

|screenshot =

|caption =

|collapsible =

|author = Nico Schottelius, Steven Armstrong

|developer =

|released = {{Start date and age|2010}}

|latest release version = 6.9.8

|latest release date = {{Start date and age|2021|08|24|df=yes}}{{cite web

| url = https://code.ungleich.ch/ungleich-public/cdist/tags

| title = Tags - cdist - Gitea: Git with a cup of tea

| website = code.ungleich.ch

| access-date = 2022-01-15

}}

|programming language = Python, Bourne shell

|operating system = Linux, Unix-like, macOS{{cite web

| url = https://www.cdi.st/manual/latest/cdist-os.html

| title = 3. Supported operating systems — cdist 6.9.8 documentation

| website = cdi.st

| access-date = 2022-01-15

}}

|platform =

|size =

|language =

|genre = Software configuration management

|license = GNU General Public License version 3 or later

|website = {{URL|https://www.cdi.st/}}

}}

cdist is a free software configuration management tool for Unix-like systems. It manages

nodes 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.{{cite web |url=https://github.com/skonfig/.github/blob/df2f84b694afee8137b97695f6424c5aec314717/profile/README.md |title=.github/README.md at df2f84b694afee8137b97695f6424c5aec314717 · skonfig/.github |website=GitHub.com}}

Development

cdist development started in 2010 at ETH Zurich and

is actively being developed[http://cia.vc/stats/project/cdist]{{dead link|date=April 2016}} and is maintained primarily by Nico Schottelius and

Steven Armstrong.{{cite web |url=https://github.com/telmich/cdist |title=ungleich/cdist: cdist configuration management |website=GitHub.com |access-date=2016-04-10 |archive-url=https://web.archive.org/web/20150705072143/https://github.com/telmich/cdist |archive-date=2015-07-05 |url-status=live }}

cdist is being used at various companies in Switzerland (such as ETH Zurich{{cite web |url=http://sans.ethz.ch/projects/cdist/ |title=Cdist configuration management |access-date=2012-06-08 |url-status=dead |archive-url=https://archive.today/20130115205250/http://sans.ethz.ch/projects/cdist/ |archive-date=2013-01-15 }} and The OMA Browser project),{{cite web|url=http://omabrowser.org/about.html |title=About the OMA Browser |access-date=June 26, 2012 |url-status=dead |archive-url=https://web.archive.org/web/20120817101530/http://omabrowser.org/about.html |archive-date=August 17, 2012 }} 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.{{cite web|url=https://groups.google.com/group/puppet-users/browse_thread/thread/e1b1ede3ad3b0a8e/98f6b2c9d78032e8 |title=Google Groups |website=Groups.google.com |access-date=2016-04-10}}

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.{{cite web|url=http://nico.schottelius.org/software/cdist/man/latest/man7/cdist-type.html |title=cdist-type(7) |website=Nico.schottelius.org |access-date=2016-04-10 |url-status=dead |archive-url=https://web.archive.org/web/20160303233448/http://www.nico.schottelius.org/software/cdist/man/latest/man7/cdist-type.html |archive-date=2016-03-03 }}

The types essentially consists of a number of shell scripts to define which types a type

reuses and which code is generated to be executed on the target host.

Architecture

cdist is split into two components:

  • The core
  • The configuration scripts

=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

  • The initial manifest, an entry point where all configuration runs begin. This script typically uses information about the target node, such as its hostname and operating system, to call other, more specific scripts which perform the actual configuration.
  • Global Explorers, small scripts which glean information about the target system (such as operating system, init system, and hostname)
  • Types, which describe reusable chunks of configuration. Types are instantiated in manifests and are the only way to actually run code on the target machines. The name "type" is meant as an analog to "class" in an object-oriented language, because a type can be turned into multiple "objects" depending on what parameters are passed to it.{{Cite web|url=https://www.nico.schottelius.org/software/cdist/man/beta/cdist-manifest.html|title=13. Manifest — cdist 4.10.6-6-g61ac4a26 documentation|website=www.nico.schottelius.org|access-date=2019-03-26}} For instance, the __file type can be turned into multiple "objects", each one representing the creation of a certain file. Ansible's "roles" are the equivalent of cdist's types. Types can have many components:
  • Object ID: When a type is turned into an object, it is passed a unique object ID. The same type cannot be instantiated twice with the same ID. This ID is not random like a UUID, but rather is some unique identifier that is meaningful in relation to the type. For example, the __file type's ID is the absolute path to the file.
  • Parameters: Many types cannot be fully described by the object ID, and take additional information in the form of parameters. The __file type takes a group parameter which specifies to which Unix group should own the file.
  • Explorers: In addition to the global explorers described above, types sometimes have their own explorers that collect type-specific information from the remote machine. The __file type uses explorers to determine whether the file being created already exists. It sometimes uses this information to skip creation of the file.
  • Manifest: A type manifest can instantiate other types, making code re-use easy.
  • Gencode Scripts: The gencode-remote script is the main way to actually update the configuration of target nodes. gencode-remote runs on the local machine, but its standard output is sent to the remote machine and executed as a shell script. There is also a less frequently used gencode-local script which outputs code to be run locally.

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 reading

and 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 to

types:

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 of

advanced 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 - << DONE

Here goes the content for /tmp/whatever

DONE

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 {{mono|$__object}}.

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.

References

{{Reflist|2|refs=

{{cite book|title=Learning Chef|isbn=978-1783285211|pages=10, 17–18|first1=Rishabh|last1=Sharma|first2=Mitesh|last2=Soni|publisher=Packt|date=15 March 2015}}

{{cite web|title=cdist|url=http://www.softpanorama.org/Admin/Conf_management/cdist.shtml

|first=Nikolai|last=Bezroukov|access-date=22 November 2018|website=Softpanorama

|url-status=live|archive-url=https://web.archive.org/web/20170708204507/http://www.softpanorama.org/Admin/Conf_management/cdist.shtml|archive-date=8 July 2017|df=dmy-all}}

{{cite thesis|title=A Study of Configuration Management - Systems Solutions for Deployment and Configuration of Software in a Cloud Environment

|first1=Kim|last1=Torberntsson|first2=Ylva|last2=Rydin|date=June 2014|publisher=Uppsala University|pages=8,27,31,42

|url=http://www.diva-portal.org/smash/get/diva2:732615/FULLTEXT01.pdf

|url-status=live|archive-url=https://web.archive.org/web/20181122140855/http://www.diva-portal.org/smash/get/diva2:732615/FULLTEXT01.pdf|archive-date=22 November 2018|df=dmy-all}}

{{cite web|title=Automatic configuration deployment with cdist|date=2016|access-date=22 November 2018|website=WWWTech|first=Christian|last=Kruse

|url=https://wwwtech.de/articles/2015/feb/automatic-configuration-deployment-with-cdist

|url-status=live|archive-url=https://web.archive.org/web/20181122144404/https://wwwtech.de/articles/2015/feb/automatic-configuration-deployment-with-cdist|archive-date=22 November 2018|df=dmy-all}}

{{cite web

| title = Installing Ansible — Ansible Documentation

| access-date = 13 January 2023

| website = docs.ansible.com

| url = https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements

| quote = The managed node (the machine that Ansible is managing) does not require Ansible to be installed, but requires Python 2.7, or Python 3.5 - 3.11 to run Ansible library code.

}}

}}