Update beta docs

This commit is contained in:
Darko Poljak 2019-01-25 16:18:27 +01:00
parent 72f6c29192
commit 25aad57283
260 changed files with 54488 additions and 34768 deletions

View File

@ -13,15 +13,18 @@ See sshd_config(5) and ssh-keygen(1).
Speeding up ssh connections
---------------------------
When connecting to a new host, the initial delay with ssh connections
is pretty big. You can work around this by
"sharing of multiple sessions over a single network connection"
(quote from ssh_config(5)). The following code is suitable for
inclusion into your ~/.ssh/config::
is pretty big. As cdist makes many connections to each host successive
connections can be sped up by "sharing of multiple sessions over a single
network connection" (quote from ssh_config(5)). This is also called "connection
multiplexing".
Host *
ControlPath ~/.ssh/master-%l-%r@%h:%p
ControlMaster auto
ControlPersist 10
Cdist implements this since v4.0.0 by executing ssh with the appropriate
options (`-o ControlMaster=auto -o ControlPath=/tmp/<tmpdir>/s -o
ControlPersist=2h`).
Note that the sshd_config on the server can configure the maximum number of
parallel multiplexed connections this with `MaxSessions N` (N defaults to 10
for OpenSSH v7.4).
Speeding up shell execution

View File

@ -0,0 +1,98 @@
Local cache overview
====================
Description
-----------
While executing, cdist stores data to local cache. Currently this feature is
one way only. That means that cdist does not use stored data for future runs.
Anyway, those data can be used for debugging cdist, debugging types and
debugging after host configuration fails.
Local cache is saved under $HOME/.cdist/cache directory, one directory entry
for each host. Subdirectory path is specified by
:strong:`-C/--cache-path-pattern` option, :strong:`cache_path_pattern`
configuration option or by using :strong:`CDIST_CACHE_PATH_PATTERN`
environment variable.
For more info on cache path pattern see :strong:`CACHE PATH PATTERN FORMAT`
section in cdist man page.
Cache overview
--------------
As noted above each configured host has got its subdirectory in local cache.
Entries in host's cache directory are as follows.
bin
directory with cdist type emulators
conf
dynamically determined cdist conf directory, union of all specified
conf directories
explorer
directory containing global explorer named files containing explorer output
after running on target host
messages
file containing messages
object
directory containing subdirectory for each cdist object
object_marker
object marker for this particular cdist run
stderr
directory containing init manifest and remote stderr stream output
stdout
directory containing init manifest and remote stdout stream output
target_host
file containing target host of this cdist run, as specified when running
cdist
typeorder
file containing types in order of execution.
Object cache overview
~~~~~~~~~~~~~~~~~~~~~
Each object under :strong:`object` directory has its own structurue.
code-local
code generated from gencode-local, present only if something is
generated
code-remote
code generated from gencode-remote, present only if something is
generated
explorer
directory containing type explorer named files containing explorer output
after running on target host
files
directory with object files created during type execution
parameter
directory containing type parameter named files containing parameter
values
source
this type's source (init manifest)
state
this type execution state ('done' when finished)
stderr
directory containing type's manifest, gencode-* and code-* stderr stream
outputs
stdin
this type stdin content
stdout
directory containing type's manifest, gencode-* and code-* stdout stream
outputs.

View File

@ -0,0 +1,103 @@
Configuration
=============
Description
-----------
cdist obtains configuration data from the following sources in the following
order:
#. command-line options
#. configuration file specified at command-line using -g command line option
#. configuration file specified in CDIST_CONFIG_FILE environment variable
#. environment variables
#. user's configuration file (first one found of ~/.cdist.cfg, $XDG_CONFIG_HOME/cdist/cdist.cfg, in specified order)
#. in-distribution configuration file (cdist/conf/cdist.cfg)
#. system-wide configuration file (/etc/cdist.cfg)
if one exists.
Configuration source with lower ordering number from above has a higher
precedence. Configuration option value read from source with higher
precedence will overwrite option value, if exists, read from source with
lower precedence. That means that command-line option wins them all.
Users can decide on the local conifguration file location. It can be either
~/.cdist.cfg or $XDG_CONFIG_HOME/cdist/cdist.cfg. Note that, if both exist,
then ~/.cdist.cfg is used.
For a per-project configuration, particular environment variables or better,
CDIST_CONFIG_FILE environment variable or -g CONFIG_FILE command line option,
can be used.
Config file format
------------------
cdist configuration file is in the INI file format. Currently it supports
only [GLOBAL] section.
The possible keywords and their meanings are as follows:
:strong:`archiving`
Use specified archiving. Valid values include:
'none', 'tar', 'tgz', 'tbz2' and 'txz'.
:strong:`beta`
Enable beta functionality. It recognizes boolean values from
'yes'/'no', 'on'/'off', 'true'/'false' and '1'/'0'.
:strong:`cache_path_pattern`
Specify cache path pattern.
:strong:`conf_dir`
List of configuration directories separated with the character conventionally
used by the operating system to separate search path components (as in PATH),
such as ':' for POSIX or ';' for Windows.
If also specified at command line then values from command line are
appended to this value.
:strong:`init_manifest`
Specify default initial manifest.
:strong:`inventory_dir`
Specify inventory directory.
:strong:`jobs`
Specify number of jobs for parallel processing. If -1 then the default,
number of CPU's in the system is used. If 0 then parallel processing in
jobs is disabled. If set to positive number then specified maximum
number of processes will be used.
:strong:`local_shell`
Shell command used for local execution.
:strong:`out_path`
Directory to save cdist output in.
:strong:`parallel`
Process hosts in parallel. If -1 then the default, number of CPU's in
the system is used. If 0 then parallel processing of hosts is disabled.
If set to positive number then specified maximum number of processes
will be used.
:strong:`remote_copy`
Command to use for remote copy (should behave like scp).
:strong:`remote_exec`
Command to use for remote execution (should behave like ssh).
:strong:`remote_out_path`
Directory to save cdist output in on the target host.
:strong:`remote_shell`
Shell command at remote host used for remote execution.
:strong:`save_output_streams`
Enable/disable saving output streams (enabled by default).
It recognizes boolean values from 'yes'/'no', 'on'/'off', 'true'/'false'
and '1'/'0'.
:strong:`timestamp`
Timestamp log messages with the current local date and time
in the format: YYYYMMDDHHMMSS.us.
:strong:`verbosity`
Set verbosity level. Valid values are:
'ERROR', 'WARNING', 'INFO', 'VERBOSE', 'DEBUG', 'TRACE' and 'OFF'.

View File

@ -59,10 +59,9 @@ How to submit a new type
For detailed information about types, see `cdist type <cdist-type.html>`_.
Submitting a type works as described above, with the additional requirement
that a corresponding manpage named man.text in asciidoc format with
that a corresponding manpage named man.rst in ReSTructured text format with
the manpage-name "cdist-type__NAME" is included in the type directory
AND asciidoc is able to compile it (i.e. do NOT have to many "=" in the second
line).
AND the manpage builds (`make man`).
Warning: Submitting "exec" or "run" types that simply echo their parameter in
**gencode** will not be accepted, because they are of no use. Every type can output

View File

@ -40,6 +40,20 @@ To install cdist, execute the following commands:
cd cdist
export PATH=$PATH:$(pwd -P)/bin
To install cdist with distutils from cloned repository, first you have to
create version.py:
.. code-block:: sh
make version
Then, as usual, you execute the following command:
.. code-block:: sh
python setup.py install
Available versions in git
^^^^^^^^^^^^^^^^^^^^^^^^^
@ -117,7 +131,10 @@ some other custom .cdist directory, e.g. /opt/cdist then use:
.. code-block:: sh
DOT_CDIST_PATH=/opt/cdist make dotman
make DOT_CDIST_PATH=/opt/cdist dotman
Note that `dotman`-target has to be built before a `make docs`-run, otherwise
the custom man-pages are not picked up.
Python package
~~~~~~~~~~~~~~

View File

@ -0,0 +1,47 @@
cdist integration / using cdist as library
==========================================
Description
-----------
cdist can be integrate with other applications by importing cdist and other
cdist modules and setting all by hand. There are also helper functions which
aim to ease this integration. Just import **cdist.integration** and use its
functions:
* :strong:`cdist.integration.configure_hosts_simple` for configuration
* :strong:`cdist.integration.install_hosts_simple` for installation.
Functions require `host` and `manifest` parameters.
`host` can be specified as a string representing host or as iterable
of hosts. `manifest` is a path to initial manifest. For other cdist
options default values will be used. `verbose` is a desired verbosity
level which defaults to VERBOSE_INFO. `cdist_path` parameter specifies
path to cdist executable, if it is `None` then functions will try to
find it first from local lib directory and then in PATH.
In case of cdist error :strong:`cdist.Error` exception is raised.
:strong:`WARNING`: cdist integration helper functions are not yet stable!
Examples
--------
.. code-block:: sh
# configure host from python interactive shell
>>> import cdist.integration
>>> cdist.integration.configure_hosts_simple('185.203.114.185',
... '~/.cdist/manifest/init')
# configure host from python interactive shell, specifying verbosity level
>>> import cdist.integration
>>> cdist.integration.configure_hosts_simple(
... '185.203.114.185', '~/.cdist/manifest/init',
... verbose=cdist.argparse.VERBOSE_TRACE)
# configure specified dns hosts from python interactive shell
>>> import cdist.integration
>>> hosts = ('dns1.ungleich.ch', 'dns2.ungleich.ch', 'dns3.ungleich.ch', )
>>> cdist.integration.configure_hosts_simple(hosts,
... '~/.cdist/manifest/init')

View File

@ -64,7 +64,7 @@ Examples
# Delete hosts from file old-hosts from inventory
$ cdist inventory del-host -b -f old-hosts
# Add tags to specifed hosts
# Add tags to specified hosts
$ cdist inventory add-tag -b -t europe,croatia,web,static web1 web2
# Add tag to all hosts in inventory

View File

@ -0,0 +1,573 @@
Dive into real world cdist
==========================
Introduction
------------
This walkthrough shows real world cdist configuration example.
Sample target host is named **test.ungleich.ch**.
Just replace **test.ungleich.ch** with your target hostname.
Our goal is to configure python application hosting. For writing sample
application we will use `Bottle <http://bottlepy.org>`_ WSGI micro web-framework.
It will use PostgreSQL database and it will list items from **items** table.
It will be served by uWSGI server. We will also use the Nginx web server
as a reverse proxy and we want HTTPS.
For HTTPS we will use Let's Encrypt certificate.
For setting up hosting we want to use cdist so we will write a new type
for that. This type will:
- install required packages
- create OS user, user home directory and application home directory
- create PostgreSQL database
- configure uWSGI
- configure Let's Encrypt certificate
- configure nginx.
Our type will not create the actual python application. Its intention is only
to configure hosing for specified user and project. It is up to the user to
create his/her applications.
So let's start.
Creating type layout
--------------------
We will create a new custom type. Let's call it **__sample_bottle_hosting**.
Go to **~/.cdist/type** directory (create it if it does not exist) and create
new type layout::
cd ~/.cdist/type
mkdir __sample_bottle_hosting
cd __sample_bottle_hosting
touch manifest gencode-remote
mkdir parameter
touch parameter/required
Creating __sample_bottle_hosting type parameters
------------------------------------------------
Our type will be configurable through the means of parameters. Let's define
the following parameters:
projectname
name for the project, needed for uWSGI ini file
user
user name
domain
target host domain, needed for Let's Encrypt certificate.
We define parameters to make our type reusable for different projects, user and domain.
Define required parameters::
printf "projectname\n" >> parameter/required
printf "user\n" >> parameter/required
printf "domain\n" >> parameter/required
For details on type parameters see `Defining parameters <cdist-type.html#defining-parameters>`_.
Creating __sample_bottle_hosting type manifest
----------------------------------------------
Next step is to define manifest (~/.cdist/type/__sample_bottle_hosting/manifest).
We also want our type to currently support only Devuan. So we will start by
checking target host OS. We will use `os <cdist-reference.html#explorers>`_
global explorer::
os=$(cat "$__global/explorer/os")
case "$os" in
devuan)
:
;;
*)
echo "OS $os currently not supported" >&2
exit 1
;;
esac
If target host OS is not Devuan then we print error message to stderr
and exit. For other OS-es support we should check and change package names
we should install, because packages differ in different OS-es and in different
OS distributions like GNU/Linux distributions. There can also be a different
configuration locations (e.g. nginx config directory could be in /usr/local tree).
If we detected unsupported OS we should error out. cdist will stop configuration
process and output error message.
Creating user and user directories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Then we create user and his/her home directory and application home directory.
We will use existing cdist types `__user <man7/cdist-type__user.html>`_ and `__directory <man7/cdist-type__directory.html>`_::
user="$(cat "$__object/parameter/user")"
home="/home/$user"
apphome="$home/app"
# create user
__user "$user" --home "$home" --shell /bin/bash
# create user home dir
require="__user/$user" __directory "$home" \
--owner "$user" --group "$user" --mode 0755
# create app home dir
require="__user/$user __directory/$home" __directory "$apphome" \
--state present --owner "$user" --group "$user" --mode 0755
First we define *user*, *home* and *apphome* variables. User is defined by type's
**user** parameter. Here we use **require** which is cdist's way to define dependencies.
User home directory should be created **after** user is created. And application
home directory is created **after** both user and user home directory are created.
For details on **require** see `Dependencies <cdist-manifest.html#dependencies>`_.
Installing packages
~~~~~~~~~~~~~~~~~~~
Install required packages using existing `__package <man7/cdist-type__package.html>`_ type.
Before installing package we want to update apt package index using
`__apt_update_index <man7/cdist-type__apt_update_index.html>`_::
# define packages that need to be installed
packages_to_install="nginx uwsgi-plugin-python3 python3-dev python3-pip postgresql postgresql-contrib libpq-dev python3-venv uwsgi python3-psycopg2"
# update package index
__apt_update_index
# install packages
for package in $packages_to_install
do require="__apt_update_index" __package $package --state=present
done
Here we use shell for loop. It executes **require="__apt_update_index" __package**
for each member in a list we define in **packages_to_install** variable.
This is much nicer then having as many **require="__apt_update_index" __package**
lines as there are packages we want to install.
For python packages we use `__package_pip <man7/cdist-type__package_pip.html>`_::
# install pip3 packages
for package in bottle bottle-pgsql; do
__package_pip --pip pip3 $package
done
Creating PostgreSQL database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create PostgreSQL database using `__postgres_database <man7/cdist-type__postgres_database.html>`_
and `__postgres_role <man7/cdist-type__postgres_role.html>`_ for creating database user::
#PostgreSQL db & user
postgres_server=postgresql
# create PostgreSQL db user
require="__package/postgresql" __postgres_role $user --login --createdb
# create PostgreSQL db
require="__postgres_role/$user __package/postgresql" __postgres_database $user \
--owner $user
Configuring uWSGI
~~~~~~~~~~~~~~~~~
Configure uWSGI using `__file <man7/cdist-type__file.html>`_ type::
# configure uWSGI
projectname="$(cat "$__object/parameter/projectname")"
require="__package/uwsgi" __file /etc/uwsgi/apps-enabled/$user.ini \
--owner root --group root --mode 0644 \
--state present \
--source - << EOF
[uwsgi]
socket = $apphome/uwsgi.sock
chdir = $apphome
wsgi-file = $projectname/wsgi.py
touch-reload = $projectname/wsgi.py
processes = 4
threads = 2
chmod-socket = 666
daemonize=true
vacuum = true
uid = $user
gid = $user
EOF
We require package uWSGI present in order to create **/etc/uwsgi/apps-enabled/$user.ini** file.
Installation of uWSGI also creates configuration layout: **/etc/uwsgi/apps-enabled**.
If this directory does not exist then **__file** type would error.
We also use stdin as file content source. For details see `Input from stdin <cdist-type.html#input-from-stdin>`_.
For feading stdin we use here-document (**<<** operator). It allows redirection of subsequent
lines read by the shell to the input of a command until a line containing only the delimiter
and a newline, with no blank characters in between (EOF in our case).
Configuring nginx for Let's Encrypt and HTTPS redirection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Next configure nginx for Let's Encrypt and for HTTP -> HTTPS redirection. For this
purpose we will create new type **__sample_nginx_http_letsencrypt_and_ssl_redirect**
and use it here::
domain="$(cat "$__object/parameter/domain")"
webroot="/var/www/html"
__sample_nginx_http_letsencrypt_and_ssl_redirect "$domain" --webroot "$webroot"
Configuring certificate creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
After HTTP nginx configuration we will create Let's Encrypt certificate using
`__letsencrypt_cert <man7/cdist-type__letsencrypt_cert.html>`_ type.
For Let's Encrypt cert configuration ensure that there is a DNS entry for your
domain. We assure that cert creation is applied after nginx HTTP is configured
for Let's Encrypt to work::
# create SSL cert
require="__package/nginx __sample_nginx_http_letsencrypt_and_ssl_redirect/$domain" \
__letsencrypt_cert --admin-email admin@test.ungleich.ch \
--webroot "$webroot" \
--automatic-renewal \
--renew-hook "service nginx reload" \
--domain "$domain" \
"$domain"
Configuring nginx HTTPS server with uWSGI upstream
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Then we can configure nginx HTTPS server that will use created Let's Encrypt certificate::
# configure nginx
require="__package/nginx __letsencrypt_cert/$domain" \
__file "/etc/nginx/sites-enabled/https-$domain" \
--source - --mode 0644 << EOF
upstream _bottle {
server unix:$apphome/uwsgi.sock;
}
server {
listen 443;
listen [::]:443;
server_name $domain;
access_log /var/log/nginx/access.log;
ssl on;
ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;
client_max_body_size 256m;
location / {
try_files \$uri @uwsgi;
}
location @uwsgi {
include uwsgi_params;
uwsgi_pass _bottle;
}
}
EOF
Now our manifest is finished.
Complete __sample_bottle_hosting type manifest listing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is complete __sample_bottle_hosting type manifest listing,
located in ~/.cdist/type/__sample_bottle_hosting/manifest::
#!/bin/sh
os=$(cat "$__global/explorer/os")
case "$os" in
devuan)
:
;;
*)
echo "OS $os currently not supported" >&2
exit 1
;;
esac
projectname="$(cat "$__object/parameter/projectname")"
user="$(cat "$__object/parameter/user")"
home="/home/$user"
apphome="$home/app"
domain="$(cat "$__object/parameter/domain")"
# create user
__user "$user" --home "$home" --shell /bin/bash
# create user home dir
require="__user/$user" __directory "$home" \
--owner "$user" --group "$user" --mode 0755
# create app home dir
require="__user/$user __directory/$home" __directory "$apphome" \
--state present --owner "$user" --group "$user" --mode 0755
# define packages that need to be installed
packages_to_install="nginx uwsgi-plugin-python3 python3-dev python3-pip postgresql postgresql-contrib libpq-dev python3-venv uwsgi python3-psycopg2"
# update package index
__apt_update_index
# install packages
for package in $packages_to_install
do require="__apt_update_index" __package $package --state=present
done
# install pip3 packages
for package in bottle bottle-pgsql; do
__package_pip --pip pip3 $package
done
#PostgreSQL db & user
postgres_server=postgresql
# create PostgreSQL db user
require="__package/postgresql" __postgres_role $user --login --createdb
# create PostgreSQL db
require="__postgres_role/$user __package/postgresql" __postgres_database $user \
--owner $user
# configure uWSGI
require="__package/uwsgi" __file /etc/uwsgi/apps-enabled/$user.ini \
--owner root --group root --mode 0644 \
--state present \
--source - << EOF
[uwsgi]
socket = $apphome/uwsgi.sock
chdir = $apphome
wsgi-file = $projectname/wsgi.py
touch-reload = $projectname/wsgi.py
processes = 4
threads = 2
chmod-socket = 666
daemonize=true
vacuum = true
uid = $user
gid = $user
EOF
# setup nginx HTTP for Let's Encrypt and SSL redirect
domain="$(cat "$__object/parameter/domain")"
webroot="/var/www/html"
__sample_nginx_http_letsencrypt_and_ssl_redirect "$domain" --webroot "$webroot"
# create SSL cert
require="__package/nginx __sample_nginx_http_letsencrypt_and_ssl_redirect/$domain" \
__letsencrypt_cert --admin-email admin@test.ungleich.ch \
--webroot "$webroot" \
--automatic-renewal \
--renew-hook "service nginx reload" \
--domain "$domain" \
"$domain"
# configure nginx
require="__package/nginx __letsencrypt_cert/$domain" \
__file "/etc/nginx/sites-enabled/https-$domain" \
--source - --mode 0644 << EOF
upstream _bottle {
server unix:$apphome/uwsgi.sock;
}
server {
listen 443;
listen [::]:443;
server_name $domain;
access_log /var/log/nginx/access.log;
ssl on;
ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;
client_max_body_size 256m;
location / {
try_files \$uri @uwsgi;
}
location @uwsgi {
include uwsgi_params;
uwsgi_pass _bottle;
}
}
EOF
Creating __sample_bottle_hosting type gencode-remote
----------------------------------------------------
Now define **gencode-remote** script: ~/.cdist/type/__sample_bottle_hosting/gencode-remote.
After manifest is applied it should restart uWSGI and nginx services so that our
configuration is active. Our gencode-remote looks like the following::
echo "service uwsgi restart"
echo "service nginx restart"
Our **__sample_bottle_hosting** type is now finished.
Creating __sample_nginx_http_letsencrypt_and_ssl_redirect type
--------------------------------------------------------------
Let's now create **__sample_nginx_http_letsencrypt_and_ssl_redirect** type::
cd ~/.cdist/type
mkdir __sample_nginx_http_letsencrypt_and_ssl_redirect
cd __sample_nginx_http_letsencrypt_and_ssl_redirect
mkdir parameter
echo webroot > parameter/required
touch manifest
touch gencode-remote
Edit manifest::
domain="$__object_id"
webroot="$(cat "$__object/parameter/webroot")"
# make sure we have nginx package
__package nginx
# setup Let's Encrypt HTTP acme challenge, redirect HTTP to HTTPS
require="__package/nginx" __file "/etc/nginx/sites-enabled/http-$domain" \
--source - --mode 0644 << EOF
server {
listen *:80;
listen [::]:80;
server_name $domain;
# Let's Encrypt
location /.well-known/acme-challenge/ {
root $webroot;
}
# Everything else -> SSL
location / {
return 301 https://\$host\$request_uri;
}
}
EOF
Edit gencode-remote::
echo "service nginx reload"
Creating init manifest
----------------------
Next create init manifest::
cd ~/.cdist/manifest
printf "__sample_bottle_hosting --projectname sample --user app --domain \$__target_host sample\n" > sample
Using this init manifest our target host will be configured using our **__sample_bottle_hosting**
type with projectname *sample*, user *app* and domain equal to **__target_host**.
Here the last positional argument *sample* is type's object id. For details on
**__target_host** and **__object_id** see
`Environment variables (for reading) <cdist-reference.html#environment-variables-for-reading>`_
reference.
Configuring host
----------------
Finally configure test.ungleich.ch::
cdist config -v -i ~/.cdist/manifest/sample test.ungleich.ch
After cdist configuration is successfully finished our host is ready.
Creating python bottle application
----------------------------------
We now need to create Bottle application. As you remember from the beginning
of this walkthrough our type does not create the actual python application,
its intention is only to configure hosing for specified user and project.
It is up to the user to create his/her applications.
Become app user::
su -l app
Preparing database
~~~~~~~~~~~~~~~~~~
We need to prepare database for our application. Create table and
insert some items::
psql -c "create table items (item varchar(255));"
psql -c "insert into items(item) values('spam');"
psql -c "insert into items(item) values('eggs');"
psql -c "insert into items(item) values('sausage');"
Creating application
~~~~~~~~~~~~~~~~~~~~
Next create sample app::
cd /home/app/app
mkdir sample
cd sample
Create app.py with the following content::
#!/usr/bin/env python3
import bottle
import bottle_pgsql
app = application = bottle.Bottle()
plugin = bottle_pgsql.Plugin('dbname=app user=app password=')
app.install(plugin)
@app.route('/')
def show_index(db):
db.execute('select * from items')
items = db.fetchall() or []
rv = '<html><body><h3>Items:</h3><ul>'
for item in items:
rv += '<li>' + str(item['item']) + '</li>'
rv += '</ul></body></html>'
return rv
if __name__ == '__main__':
bottle.run(app=app, host='0.0.0.0', port=8080)
Create wsgi.py with the following content::
import os
os.chdir(os.path.dirname(__file__))
import app
application = app.app
We have configured uWSGI with **touch-reload = $projectname/wsgi.py** so after
we have changed our **wsgi.py** file uWSGI reloads the application.
Our application selects and lists items from **items** table.
Openning application
~~~~~~~~~~~~~~~~~~~~
Finally try the application::
http://test.ungleich.ch/
It should redirect to HTTPS and return:
.. container:: highlight
.. raw:: html
<h3>Items:</h3>
<ul>
<li>spam</li>
<li>eggs</li>
<li>sausage</li>
</ul>
What's next?
------------
Continue reading next sections ;)

View File

@ -12,6 +12,7 @@ The following global explorers are available:
- hostname
- init
- interfaces
- is-freebsd-jail
- kernel_name
- lsb_codename
- lsb_description
@ -21,6 +22,7 @@ The following global explorers are available:
- machine_type
- memory
- os
- os_release
- os_version
- runlevel
@ -38,6 +40,9 @@ cdist/inventory/
The distribution inventory directory.
This path is relative to cdist installation directory.
cdist/preos/
The distribution PreOS plugins directory.
confdir
Cdist will use all available configuration directories and create
a temporary confdir containing links to the real configuration directories.
@ -131,6 +136,8 @@ Types
-----
The following types are available:
- __acl (`cdist-type__acl(7) <man7/cdist-type__acl.html>`_)
- __apt_default_release (`cdist-type__apt_default_release(7) <man7/cdist-type__apt_default_release.html>`_)
- __apt_key (`cdist-type__apt_key(7) <man7/cdist-type__apt_key.html>`_)
- __apt_key_uri (`cdist-type__apt_key_uri(7) <man7/cdist-type__apt_key_uri.html>`_)
- __apt_mark (`cdist-type__apt_mark(7) <man7/cdist-type__apt_mark.html>`_)
@ -167,6 +174,10 @@ The following types are available:
- __directory (`cdist-type__directory(7) <man7/cdist-type__directory.html>`_)
- __docker (`cdist-type__docker(7) <man7/cdist-type__docker.html>`_)
- __docker_compose (`cdist-type__docker_compose(7) <man7/cdist-type__docker_compose.html>`_)
- __docker_config (`cdist-type__docker_config(7) <man7/cdist-type__docker_config.html>`_)
- __docker_secret (`cdist-type__docker_secret(7) <man7/cdist-type__docker_secret.html>`_)
- __docker_stack (`cdist-type__docker_stack(7) <man7/cdist-type__docker_stack.html>`_)
- __docker_swarm (`cdist-type__docker_swarm(7) <man7/cdist-type__docker_swarm.html>`_)
- __dog_vdi (`cdist-type__dog_vdi(7) <man7/cdist-type__dog_vdi.html>`_)
- __dot_file (`cdist-type__dot_file(7) <man7/cdist-type__dot_file.html>`_)
- __file (`cdist-type__file(7) <man7/cdist-type__file.html>`_)
@ -184,6 +195,7 @@ The following types are available:
- __install_chroot_mount (`cdist-type__install_chroot_mount(7) <man7/cdist-type__install_chroot_mount.html>`_)
- __install_chroot_umount (`cdist-type__install_chroot_umount(7) <man7/cdist-type__install_chroot_umount.html>`_)
- __install_config (`cdist-type__install_config(7) <man7/cdist-type__install_config.html>`_)
- __install_coreos (`cdist-type__install_coreos(7) <man7/cdist-type__install_coreos.html>`_)
- __install_directory (`cdist-type__install_directory(7) <man7/cdist-type__install_directory.html>`_)
- __install_file (`cdist-type__install_file(7) <man7/cdist-type__install_file.html>`_)
- __install_fstab (`cdist-type__install_fstab(7) <man7/cdist-type__install_fstab.html>`_)
@ -204,6 +216,7 @@ The following types are available:
- __jail_freebsd9 (`cdist-type__jail_freebsd9(7) <man7/cdist-type__jail_freebsd9.html>`_)
- __key_value (`cdist-type__key_value(7) <man7/cdist-type__key_value.html>`_)
- __keyboard (`cdist-type__keyboard(7) <man7/cdist-type__keyboard.html>`_)
- __letsencrypt_cert (`cdist-type__letsencrypt_cert(7) <man7/cdist-type__letsencrypt_cert.html>`_)
- __line (`cdist-type__line(7) <man7/cdist-type__line.html>`_)
- __link (`cdist-type__link(7) <man7/cdist-type__link.html>`_)
- __locale (`cdist-type__locale(7) <man7/cdist-type__locale.html>`_)
@ -232,6 +245,7 @@ The following types are available:
- __pacman_conf_integrate (`cdist-type__pacman_conf_integrate(7) <man7/cdist-type__pacman_conf_integrate.html>`_)
- __pf_apply (`cdist-type__pf_apply(7) <man7/cdist-type__pf_apply.html>`_)
- __pf_ruleset (`cdist-type__pf_ruleset(7) <man7/cdist-type__pf_ruleset.html>`_)
- __ping (`cdist-type__ping(7) <man7/cdist-type__ping.html>`_)
- __postfix (`cdist-type__postfix(7) <man7/cdist-type__postfix.html>`_)
- __postfix_master (`cdist-type__postfix_master(7) <man7/cdist-type__postfix_master.html>`_)
- __postfix_postconf (`cdist-type__postfix_postconf(7) <man7/cdist-type__postfix_postconf.html>`_)
@ -242,6 +256,7 @@ The following types are available:
- __postgres_role (`cdist-type__postgres_role(7) <man7/cdist-type__postgres_role.html>`_)
- __process (`cdist-type__process(7) <man7/cdist-type__process.html>`_)
- __prometheus_alertmanager (`cdist-type__prometheus_alertmanager(7) <man7/cdist-type__prometheus_alertmanager.html>`_)
- __prometheus_exporter (`cdist-type__prometheus_exporter(7) <man7/cdist-type__prometheus_exporter.html>`_)
- __prometheus_server (`cdist-type__prometheus_server(7) <man7/cdist-type__prometheus_server.html>`_)
- __pyvenv (`cdist-type__pyvenv(7) <man7/cdist-type__pyvenv.html>`_)
- __qemu_img (`cdist-type__qemu_img(7) <man7/cdist-type__qemu_img.html>`_)
@ -257,6 +272,7 @@ The following types are available:
- __staged_file (`cdist-type__staged_file(7) <man7/cdist-type__staged_file.html>`_)
- __start_on_boot (`cdist-type__start_on_boot(7) <man7/cdist-type__start_on_boot.html>`_)
- __sysctl (`cdist-type__sysctl(7) <man7/cdist-type__sysctl.html>`_)
- __systemd_unit (`cdist-type__systemd_unit(7) <man7/cdist-type__systemd_unit.html>`_)
- __timezone (`cdist-type__timezone(7) <man7/cdist-type__timezone.html>`_)
- __update_alternatives (`cdist-type__update_alternatives(7) <man7/cdist-type__update_alternatives.html>`_)
- __user (`cdist-type__user(7) <man7/cdist-type__user.html>`_)
@ -287,6 +303,29 @@ Environment variables (for reading)
-----------------------------------
The following environment variables are exported by cdist:
__cdist_log_level, __cdist_log_level_name
cdist log level value and cdist log level name. One of:
+----------------+-----------------+
| Log level name | Log level value |
+================+=================+
| OFF | 60 |
+----------------+-----------------+
| ERROR | 40 |
+----------------+-----------------+
| WARNING | 30 |
+----------------+-----------------+
| INFO | 20 |
+----------------+-----------------+
| VERBOSE | 15 |
+----------------+-----------------+
| DEBUG | 10 |
+----------------+-----------------+
| TRACE | 5 |
+----------------+-----------------+
Available for: initial manifest, explorer, type manifest, type explorer,
type gencode.
__explorer
Directory that contains all global explorers.
Available for: initial manifest, explorer, type explorer, shell.
@ -349,6 +388,32 @@ The following environment variables influence the behaviour of cdist:
require
Setup dependencies between objects (see `cdist manifest <cdist-manifest.html>`_).
__cdist_log_level
cdist log level value. One of:
+----------------+-----------------+
| Log level | Log level value |
+================+=================+
| OFF | 60 |
+----------------+-----------------+
| ERROR | 40 |
+----------------+-----------------+
| WARNING | 30 |
+----------------+-----------------+
| INFO | 20 |
+----------------+-----------------+
| VERBOSE | 15 |
+----------------+-----------------+
| DEBUG | 10 |
+----------------+-----------------+
| TRACE | 5 |
+----------------+-----------------+
If set cdist will set this log level in
accordance with configuration rules. If cdist invokation is used
in types then nested cdist will honor this specified log level if
not specified otherwise while invoking it.
CDIST_PATH
Colon delimited list of config directories.

View File

@ -0,0 +1,88 @@
Saving output streams
=====================
Description
-----------
Since version 4.8.0 cdist, by default, saves output streams to local cache.
Saving output streams is implemented because important information was lost
during a config run, hidden in all other output.
Now all created output is bound to the context where it was produced.
Saving output streams include stdout and stderr of init manifest, remote
commands and for each object stdout and stderr of manifest, gencode-\* and code-\*.
Output stream files are created only if some output is produced. For more info
on these cache files see `Local cache overview <cdist-cache.html>`_.
Also, in case of an error, cdist can now exit and show all information it has
about the error.
For example:
.. code-block:: sh
$ ./bin/cdist config -v -i ~/.cdist/manifest/init-output-streams $(cat ~/ungleich/data/opennebula-debian9-test )
INFO: 185.203.112.42: Starting configuration run
INFO: 185.203.112.42: Processing __myline/test
ERROR: 185.203.112.42: Command failed: '/bin/sh -e /tmp/tmpow6cwemh/75ee6a79e32da093da23fe4a13dd104b/data/object/__myline/test/.cdist-kisrqlpw/code-local'
return code: 1
---- BEGIN stdout ----
---- END stdout ----
Error processing object '__myline/test'
========================================
name: __myline/test
path: /tmp/tmpow6cwemh/75ee6a79e32da093da23fe4a13dd104b/data/object/__myline/test/.cdist-kisrqlpw
source: /home/darko/.cdist/manifest/init-output-streams
type: /tmp/tmpow6cwemh/75ee6a79e32da093da23fe4a13dd104b/data/conf/type/__myline
---- BEGIN manifest:stderr ----
myline manifest stderr
---- END manifest:stderr ----
---- BEGIN gencode-remote:stderr ----
test gencode-remote error
---- END gencode-remote:stderr ----
---- BEGIN code-local:stderr ----
error
---- END code-local:stderr ----
ERROR: cdist: Failed to configure the following hosts: 185.203.112.42
Upon successful run execution state is saved to local cache and temporary
directory is removed.
In case of an error temporary directory is not removed and can be further
discovered.
There is also an option :strong:`-S/--disable-saving-output-streams` for
disabling saving output streams. In this case error reporting can look
like this:
.. code-block:: sh
$ ./bin/cdist config -v -S -i ~/.cdist/manifest/init-output-streams $(cat ~/ungleich/data/opennebula-debian9-test )
INFO: 185.203.112.42: Starting configuration run
test stdout output streams
test stderr output streams
myline manifest stdout
myline manifest stderr
test gencode-remote error
INFO: 185.203.112.42: Processing __myline/test
error
ERROR: 185.203.112.42: Command failed: '/bin/sh -e /tmp/tmpzomy0wis/75ee6a79e32da093da23fe4a13dd104b/data/object/__myline/test/.cdist-n566pqut/code-local'
return code: 1
---- BEGIN stdout ----
---- END stdout ----
Error processing object '__myline/test'
========================================
name: __myline/test
path: /tmp/tmpzomy0wis/75ee6a79e32da093da23fe4a13dd104b/data/object/__myline/test/.cdist-n566pqut
source: /home/darko/.cdist/manifest/init-output-streams
type: /tmp/tmpzomy0wis/75ee6a79e32da093da23fe4a13dd104b/data/conf/type/__myline
ERROR: cdist: Failed to configure the following hosts: 185.203.112.42

View File

@ -331,6 +331,46 @@ So when you generate a script with the following content, it will work:
fi
Environment variable usage idiom
--------------------------------
In type scripts you can support environment variables with default values if
environment variable is unset or null by using **${parameter:-[word]}**
parameter expansion.
Example using mktemp in a portable way that supports TMPDIR environment variable.
.. code-block:: sh
tempfile=$(mktemp "${TMPDIR:-/tmp}/cdist.XXXXXXXXXX")
Log level in types
------------------
cdist log level can be accessed from __cdist_log_level variable.One of:
+----------------+-----------------+
| Log level | Log level value |
+================+=================+
| OFF | 60 |
+----------------+-----------------+
| ERROR | 40 |
+----------------+-----------------+
| WARNING | 30 |
+----------------+-----------------+
| INFO | 20 |
+----------------+-----------------+
| VERBOSE | 15 |
+----------------+-----------------+
| DEBUG | 10 |
+----------------+-----------------+
| TRACE | 5 |
+----------------+-----------------+
It is available for initial manifest, explorer, type manifest,
type explorer, type gencode.
Hints for typewriters
----------------------
It must be assumed that the target is pretty dumb and thus does not have high

View File

@ -16,8 +16,10 @@ Contents:
cdist-support
cdist-features
cdist-quickstart
cdist-real-world
man1/cdist
cdist-bootstrap
cdist-configuration
cdist-manifest
cdist-type
cdist-types
@ -27,9 +29,12 @@ Contents:
cdist-inventory
cdist-trigger
cdist-preos
cdist-integration
cdist-reference
cdist-best-practice
cdist-stages
cdist-cache
cdist-saving-output-streams
cdist-remote-exec-copy
cdist-hacker
cdist-troubleshooting

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
cdist-type__acl(7)
==================
NAME
----
cdist-type__acl - Basic wrapper around `setfacl`
DESCRIPTION
-----------
ACL must be defined as 3-symbol combination, using `r`, `w`, `x` and `-`.
See setfacl(1) and acl(5) for more details.
OPTIONAL MULTIPLE PARAMETERS
----------------------------
user
Add user ACL entry.
group
Add group ACL entry.
BOOLEAN PARAMETERS
------------------
recursive
Operate recursively (Linux only).
default
Add default ACL entries.
remove
Remove undefined ACL entries (Solaris not supported).
EXAMPLES
--------
.. code-block:: sh
__acl /srv/project \
--recursive \
--default \
--remove \
--user alice:rwx \
--user bob:r-x \
--group project-group:rwx \
--group some-other-group:r-x
AUTHORS
-------
Ander Punnar <ander-at-kvlt-dot-ee>
COPYING
-------
Copyright \(C) 2018 Ander Punnar. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -0,0 +1,46 @@
cdist-type__apt_default_release(7)
==================================
NAME
----
cdist-type__apt_default_release - Configure the default release for apt
DESCRIPTION
-----------
Configure the default release for apt, using the APT::Default-Release
configuration value.
REQUIRED PARAMETERS
-------------------
release
The value to set APT::Default-Release to.
This can contain release name, codename or release version. Examples:
'stable', 'testing', 'unstable', 'stretch', 'buster', '4.0', '5.0*'.
OPTIONAL PARAMETERS
-------------------
None.
EXAMPLES
--------
.. code-block:: sh
__apt_default_release --release stretch
AUTHORS
-------
Matthijs Kooijman <matthijs--@--stdin.nl>
COPYING
-------
Copyright \(C) 2017 Matthijs Kooijman. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -8,7 +8,8 @@ cdist-type__apt_source - Manage apt sources
DESCRIPTION
-----------
This cdist type allows you to manage apt sources.
This cdist type allows you to manage apt sources. It invokes index update
internally when needed so call of index updating type is not needed.
REQUIRED PARAMETERS
@ -63,7 +64,7 @@ Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011-2014 Steven Armstrong. You can redistribute it
Copyright \(C) 2011-2018 Steven Armstrong. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -38,6 +38,8 @@ BOOLEAN PARAMETERS
verbose
Whether to report backup verbosely
create-destination
Create the directory specified in the destination parameter on the remote host
EXAMPLES
--------
@ -50,6 +52,13 @@ EXAMPLES
--exclude '/proc/*' --exclude '/sys/*' \
--verbose
__ccollect_source doc.ungleich.ch \
--source doc.ungleich.ch:/ \
--destination /backup/doc.ungleich.ch \
--exclude '/proc/*' --exclude '/sys/*' \
--verbose \
--create-destination
SEE ALSO
--------

View File

@ -10,7 +10,8 @@ DESCRIPTION
-----------
Downloads and installs the consul binary from https://dl.bintray.com/mitchellh/consul.
Note that the consul binary is downloaded on the server (the machine running
cdist) and then deployed to the target host using the __file type.
cdist) and then deployed to the target host using the __file type unless --direct
parameter is used.
REQUIRED PARAMETERS
@ -28,6 +29,22 @@ version
supported versions. Defaults to the latest known version.
BOOLEAN PARAMETERS
------------------
direct
Download and deploy consul binary directly on the target machine.
MESSAGES
--------
If consul binary is created using __staged_file then underlaying __file type messages are emitted.
If consul binary is created by direct method then the following messages are emitted:
/usr/local/bin/consul created
consul binary was created
EXAMPLES
--------
@ -36,6 +53,9 @@ EXAMPLES
# just install using defaults
__consul
# install by downloading consul binary directly on the target machine
__consul --direct
# specific version
__consul \
--version 0.4.1
@ -43,7 +63,8 @@ EXAMPLES
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
| Steven Armstrong <steven-cdist--@--armstrong.cc>
| Darko Poljak <darko.poljak--@--gmail.com>
COPYING

View File

@ -21,11 +21,16 @@ OPTIONAL PARAMETERS
from-package
Package to install. Must be compatible with the original daemontools. Example: daemontools-encore. Default: daemontools.
servicedir
Directory to scan for services. Default: `/service`
BOOLEAN PARAMETERS
------------------
install-init-script
Add an init script and set it to start on boot.
EXAMPLES
--------

View File

@ -3,12 +3,12 @@ cdist-type__docker(7)
NAME
----
cdist-type__docker - install docker-engine
cdist-type__docker - install Docker CE
DESCRIPTION
-----------
Installs latest docker-engine package from dockerproject.org.
Installs latest Docker Community Edition package.
REQUIRED PARAMETERS
@ -18,16 +18,16 @@ None.
OPTIONAL PARAMETERS
-------------------
None.
state
'present' or 'absent', defaults to 'present'
version
The specific version to install. Defaults to the special value 'latest',
meaning the version the package manager will install by default.
BOOLEAN PARAMETERS
------------------
experimental
Install the experimental docker-engine package instead of the latest stable release.
state
'present' or 'absent', defaults to 'present'
None.
EXAMPLES
@ -38,12 +38,11 @@ EXAMPLES
# Install docker
__docker
# Install experimental
__docker --experimental
# Remove docker
__docker --state absent
# Install specific version
__docker --state present --version 18.03.0.ce
AUTHORS
-------

View File

@ -0,0 +1,55 @@
cdist-type__docker_config(7)
============================
NAME
----
cdist-type__docker_config - Manage Docker configs
DESCRIPTION
-----------
This type manages Docker configs.
OPTIONAL PARAMETERS
-------------------
source
Path to the source file. If it is '-' (dash), read standard input.
state
'present' or 'absent', defaults to 'present' where:
present
if the config does not exist, it is created
absent
the config is removed
CAVEATS
-------
Since Docker configs cannot be updated once created, this type tries removing
and recreating the config if it changes. If the config is used by a service at
the time of removing, then this type will fail.
EXAMPLES
--------
.. code-block:: sh
# Creates "foo" config from "bar" source file
__docker_config foo --source bar
AUTHORS
-------
Ľubomír Kučera <lubomir.kucera.jr at gmail.com>
COPYING
-------
Copyright \(C) 2018 Ľubomír Kučera. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -0,0 +1,54 @@
cdist-type__docker_secret(7)
============================
NAME
----
cdist-type__docker_secret - Manage Docker secrets
DESCRIPTION
-----------
This type manages Docker secrets.
OPTIONAL PARAMETERS
-------------------
source
Path to the source file. If it is '-' (dash), read standard input.
state
'present' or 'absent', defaults to 'present' where:
present
if the secret does not exist, it is created
absent
the secret is removed
CAVEATS
-------
Since Docker secrets cannot be updated once created, this type takes no action
if the specified secret already exists.
EXAMPLES
--------
.. code-block:: sh
# Creates "foo" secret from "bar" source file
__docker_secret foo --source bar
AUTHORS
-------
Ľubomír Kučera <lubomir.kucera.jr at gmail.com>
COPYING
-------
Copyright \(C) 2018 Ľubomír Kučera. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -0,0 +1,54 @@
cdist-type__docker_stack(7)
===========================
NAME
----
cdist-type__docker_stack - Manage Docker stacks
DESCRIPTION
-----------
This type manages service stacks.
.. note::
Since there is no easy way to tell whether a stack needs to be updated,
`docker stack deploy` is being run every time this type is invoked.
However, it does not mean this type is not idempotent. If Docker does not
detect changes, the existing stack will not be updated.
OPTIONAL PARAMETERS
-------------------
compose-file
Path to the compose file. If it is '-' (dash), read standard input.
state
'present' or 'absent', defaults to 'present' where:
present
the stack is deployed
absent
the stack is removed
EXAMPLES
--------
.. code-block:: sh
# Deploys 'foo' stack defined in 'docker-compose.yml' compose file
__docker_stack foo --compose-file docker-compose.yml
AUTHORS
-------
Ľubomír Kučera <lubomir.kucera.jr at gmail.com>
COPYING
-------
Copyright \(C) 2018 Ľubomír Kučera. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -0,0 +1,49 @@
cdist-type__docker_swarm(7)
===========================
NAME
----
cdist-type__docker_swarm - Manage Swarm
DESCRIPTION
-----------
This type can initialize Docker swarm mode. For more information about swarm
mode, see `Swarm mode overview <https://docs.docker.com/engine/swarm/>`_.
OPTIONAL PARAMETERS
-------------------
state
'present' or 'absent', defaults to 'present' where:
present
Swarm is initialized
absent
Swarm is left
EXAMPLES
--------
.. code-block:: sh
# Initializes a swarm
__docker_swarm
# Leaves a swarm
__docker_swarm --state absent
AUTHORS
-------
Ľubomír Kučera <lubomir.kucera.jr at gmail.com>
COPYING
-------
Copyright \(C) 2018 Ľubomír Kučera. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -23,6 +23,10 @@ symlink
directory
replace it with the source file
One exception is that when state is pre-exists, an error is raised if
the file would have been created otherwise (e.g. it is not present or
not a regular file).
In any case, make sure that the file attributes are as specified.
@ -33,7 +37,7 @@ None.
OPTIONAL PARAMETERS
-------------------
state
'present', 'absent' or 'exists', defaults to 'present' where:
'present', 'absent', 'exists' or 'pre-exists', defaults to 'present' where:
present
the file is exactly the one from source
@ -41,6 +45,9 @@ state
the file does not exist
exists
the file from source but only if it doesn't already exist
pre-exists
check that the file exists and is a regular file, but do not
create or modify it
group
Group to chgrp to.
@ -93,6 +100,8 @@ EXAMPLES
__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
--state exists \
--owner frodo --mode 0600
# Check that the file is present, show an error when it is not
__file /etc/somefile --state pre-exists
# Take file content from stdin
__file /tmp/whatever --owner root --group root --mode 644 --source - << DONE
Here goes the content for /tmp/whatever

View File

@ -0,0 +1,50 @@
cdist-type__install_coreos(7)
=============================
NAME
----
cdist-type__install_coreos - Install CoreOS
DESCRIPTION
-----------
This type installs CoreOS to a given device using coreos-install_, which is
present in CoreOS ISO by default.
.. _coreos-install: https://raw.githubusercontent.com/coreos/init/master/bin/coreos-install
REQUIRED PARAMETERS
-------------------
device
A device CoreOS will be installed to.
OPTIONAL PARAMETERS
-------------------
ignition
Path to ignition config.
EXAMPLES
--------
.. code-block:: sh
__install_coreos \
--device /dev/sda \
--ignition ignition.json
AUTHORS
-------
Ľubomír Kučera <lubomir.kucera.jr at gmail.com>
COPYING
-------
Copyright \(C) 2018 Ľubomír Kučera. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -18,8 +18,7 @@ None
OPTIONAL PARAMETERS
-------------------
options
options to pass to the reboot command. e.g. -f
None
EXAMPLES

View File

@ -17,9 +17,9 @@ REQUIRED PARAMETERS
uri
The uri from which to fetch the tarball.
Can be anything understood by curl, e.g:
| http://path/to/stage.tgz
| tftp:///path/to/stage.tgz
| file:///local/path/stage.tgz
| http://path/to/stage.tgz
| tftp:///path/to/stage.tgz
| file:///local/path/stage.tgz
OPTIONAL PARAMETERS

View File

@ -34,6 +34,8 @@ comment
but only if the key or value must be changed.
You need to ensure yourself that the line is prefixed with the correct
comment sign. (for example # or ; or wathever ..)
onchange
The code to run if the key or value changes (i.e. is inserted, removed or replaced).
BOOLEAN PARAMETERS

View File

@ -0,0 +1,109 @@
cdist-type__letsencrypt_cert(7)
===============================
NAME
----
cdist-type__letsencrypt_cert - Get an SSL certificate from Let's Encrypt
DESCRIPTION
-----------
Automatically obtain a Let's Encrypt SSL certificate using Certbot.
REQUIRED PARAMETERS
-------------------
object id
A cert name. If domain parameter is not specified then it is used
as a domain to be included in the certificate.
admin-email
Where to send Let's Encrypt emails like "certificate needs renewal".
OPTIONAL PARAMETERS
-------------------
state
'present' or 'absent', defaults to 'present' where:
present
if the certificate does not exist, it will be obtained
absent
the certificate will be removed
webroot
The path to your webroot, as set up in your webserver config. If this
parameter is not present, Certbot will be run in standalone mode.
OPTIONAL MULTIPLE PARAMETERS
----------------------------
renew-hook
Renew hook command directly passed to Certbot in cron job.
domain
Domains to be included in the certificate. When specified then object id
is not used as a domain.
BOOLEAN PARAMETERS
------------------
automatic-renewal
Install a cron job, which attempts to renew certificates daily.
staging
Obtain a test certificate from a staging server.
MESSAGES
--------
change
Certificte was changed.
create
Certificte was created.
remove
Certificte was removed.
EXAMPLES
--------
.. code-block:: sh
# use object id as domain
__letsencrypt_cert example.com \
--admin-email root@example.com \
--automatic-renewal \
--renew-hook "service nginx reload" \
--webroot /data/letsencrypt/root
.. code-block:: sh
# domain parameter is specified so object id is not used as domain
# and example.com needs to be included again with domain parameter
__letsencrypt_cert example.com \
--admin-email root@example.com \
--automatic-renewal \
--domain example.com \
--domain foo.example.com \
--domain bar.example.com \
--renew-hook "service nginx reload" \
--webroot /data/letsencrypt/root
AUTHORS
-------
| Nico Schottelius <nico-cdist--@--schottelius.org>
| Kamila Součková <kamila--@--ksp.sk>
| Darko Poljak <darko.poljak--@--gmail.com>
| Ľubomír Kučera <lubomir.kucera.jr at gmail.com>
COPYING
-------
Copyright \(C) 2017-2018 Nico Schottelius, Kamila Součková, Darko Poljak and
Ľubomír Kučera. You can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.

View File

@ -13,65 +13,102 @@ This cdist type allows you to add lines and remove lines from files.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
state
'present' or 'absent', defaults to 'present'
after
Insert the given line after this pattern.
line
Specifies the line which should be absent or present
Must be present, if state is present.
Must not be combined with regex, if state is absent.
regex
If state is present, search for this pattern and add
given line, if the given regular expression does not match.
In case of absent, ensure all lines matching the
regular expression are absent.
The regular expression is interpreted by grep.
Must not be combined with line, if state is absent.
before
Insert the given line before this pattern.
file
If supplied, use this as the destination file.
Otherwise the object_id is used.
line
Specifies the line which should be absent or present.
Must be present, if state is 'present'.
Ignored if regex is given and state is 'absent'.
regex
If state is 'present', search for this pattern and if it matches add
the given line.
If state is 'absent', ensure all lines matching the regular expression
are absent.
The regular expression is interpreted by awk's match function.
state
'present' or 'absent', defaults to 'present'
BOOLEAN PARAMETERS
------------------
None.
MESSAGES
--------
added
The line was added.
updated
The line or its position was changed.
removed
The line was removed.
EXAMPLES
--------
.. code-block:: sh
# Manage the DAEMONS line in rc.conf
__line daemons --file /etc/rc.conf --line 'DAEMONS=(hwclock !network sshd crond postfix)'
# Manage a hosts entry for www.example.com.
__line /etc/hosts \
--line '127.0.0.2 www.example.com'
# Ensure the home mount is present in /etc/fstab - explicitly make it present
__line home-fstab \
--file /etc/fstab \
--line 'filer.fs:/vol/home /home nfs defaults 0 0' \
--state present
# Manage another hosts entry for test.example.com.
__line hosts:test.example.com \
--file /etc/hosts \
--line '127.0.0.3 test.example.com'
# Removes the line specifiend in "include_www" from the file "lighttpd.conf"
__line legacy_timezone --file /etc/rc.conf --regex 'TIMEZONE=.*' --state absent
# Remove the line starting with TIMEZONE from the /etc/rc.conf file.
__line legacy_timezone \
--file /etc/rc.conf \
--regex 'TIMEZONE=.*' \
--state absent
# Insert a line before another one.
__line password-auth-local:classify \
--file /etc/pam.d/password-auth-local \
--line '-session required pam_exec.so debug log=/tmp/classify.log /usr/local/libexec/classify' \
--before '^session[[:space:]]+include[[:space:]]+password-auth-ac$'
# Insert a line after another one.
__line password-auth-local:classify \
--file /etc/pam.d/password-auth-local \
--line '-session required pam_exec.so debug log=/tmp/classify.log /usr/local/libexec/classify' \
--after '^session[[:space:]]+include[[:space:]]+password-auth-ac$'
SEE ALSO
--------
:strong:`grep`\ (1)
:strong:`cdist-type`\ (7)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2012-2013 Nico Schottelius. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
Copyright \(C) 2018 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -29,6 +29,18 @@ target-release
Passed on to apt-get install, see apt-get(8).
Essentially allows you to retrieve packages from a different release
version
The version of the package to install. Default is to install the version
chosen by the local package manager.
BOOLEAN PARAMETERS
------------------
purge-if-absent
If this parameter is given when state is `absent`, the package is
purged from the system (using `--purge`).
EXAMPLES
--------

View File

@ -12,30 +12,77 @@ This type is used on Debian and variants (like Ubuntu) to
install packages that are provided locally as \*.deb files.
The object given to this type must be the name of the deb package.
The filename of the deb package has to follow Debian naming conventions, i.e.
`${binary:Package}_${Version}_${Architecture}.deb` (see `dpkg-query(1)` for
details).
OPTIONAL PARAMETERS
-------------------
state
`present` or `absent`, defaults to `present`.
REQUIRED PARAMETERS
-------------------
source
path to the \*.deb package
BOOLEAN PARAMETERS
------------------
purge-if-absent
If this parameter is given when state is `absent`, the package is
purged from the system (using `--purge`).
EXPLORER
--------
pkg_state
Returns the full package name if package is installed, empty otherwise.
MESSAGES
--------
installed
The deb-file was installed.
removed (--remove)
The package was removed, keeping config.
removed (--purge)
The package was removed including config (purged).
EXAMPLES
--------
.. code-block:: sh
# Install foo and bar packages
__package_dpkg --source /tmp/foo_0.1_all.deb foo_0.1_all.deb
__package_dpkg --source $__type/files/bar_1.4.deb bar_1.4.deb
__package_dpkg foo_0.1_all.deb --source /tmp/foo_0.1_all.deb
__package_dpkg bar_1.4.deb --source $__type/files/bar_1.4.deb
# uninstall baz:
__package_dpkg baz_1.4_amd64.deb \
--source $__type/files/baz_1.4_amd64.deb \
--state "absent"
# uninstall baz and also purge config-files:
__package_dpkg baz_1.4_amd64.deb \
--source $__type/files/baz_1.4_amd64.deb \
--purge-if-absent \
--state "absent"
SEE ALSO
--------
:strong:`cdist-type__package`\ (7)
:strong:`cdist-type__package`\ (7), :strong:`dpkg-query`\ (1)
AUTHORS
-------
Tomas Pospisek <tpo_deb--@--sourcepole.ch>
| Tomas Pospisek <tpo_deb--@--sourcepole.ch>
| Thomas Eckert <tom--@--it-eckert.de>
COPYING
-------

View File

@ -27,6 +27,16 @@ type
* yum for Red Hat
* pacman for Arch Linux
maxage
Available for package manager apt and pacman, max time in seconds since
last update. Repo update is skipped if maxage is not reached yet.
MESSAGES
--------
apt-cache updated (age was: currage)
apt-cache was updated (run of `apt-get update`). `currage` is the time
in seconds since the previous run.
EXAMPLES
--------
@ -39,10 +49,17 @@ EXAMPLES
# Force use of a specific package manager
__package_update_index --type apt
# Only update every hour:
__package_update_index --maxage 3600 --type apt
# same as above (on apt-type systems):
__package_update_index --maxage 3600
AUTHORS
-------
Ricardo Catalinas Jiménez <jimenezrick--@--gmail.com>
| Ricardo Catalinas Jiménez <jimenezrick--@--gmail.com>
| Thomas Eckert <tom--@--it-eckert.de>
| Stu Zhao <z12y12l12--@--gmail.com>
COPYING

View File

@ -0,0 +1,43 @@
cdist-type__ping(7)
==================================
NAME
----
cdist-type__ping - Try to connect to host and return 'pong' on success
DESCRIPTION
-----------
A simple type which tries to connect to a remote host and runs a simple command
to ensure everything is working.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
None.
EXAMPLES
--------
.. code-block:: sh
__ping
AUTHORS
-------
Olliver Schinagl <oliver--@--schinagl.nl>
COPYING
-------
Copyright \(C) 2018 Schinagl. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -30,6 +30,15 @@ start
Executable to use for starting the process.
MESSAGES
--------
started
The process was started.
stopped
The process was stopped.
EXAMPLES
--------
@ -63,7 +72,8 @@ SEE ALSO
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
| Nico Schottelius <nico-cdist--@--schottelius.org>
| Thomas Eckert <tom--@--it-eckert.de>
COPYING

View File

@ -10,27 +10,27 @@ DESCRIPTION
-----------
Install and configure Prometheus Alertmanager (https://prometheus.io/docs/alerting/alertmanager/).
This type create a daemontools-compatible service directory under /service/prometheus.
Daemontools (or something compatible) must be installed (in particular, the command `svc` must be executable).
Note that due to significant differences between Prometheus 1.x and 2.x, only 2.x is supported. It is your responsibility to make sure that your package manager installs 2.x. (On Devuan Ascii, the parameter `--install-from-backports` helps.)
REQUIRED PARAMETERS
-------------------
config
Alertmanager configuration file. It will be saved as /etc/alertmanager/alertmanager.yml on the target.
listen-address
Passed as web.listen-address.
OPTIONAL PARAMETERS
-------------------
storage-path
Where to put data. Default: /data/alertmanager. (Directory will be created if needed.)
retention-days
How long to retain data. Default: 90 days.
BOOLEAN PARAMETERS
------------------
None
install-from-backports
Valid on Devuan only. Will enable the backports apt source and install the package from there. Useful for getting a newer version.
EXAMPLES
@ -38,21 +38,15 @@ EXAMPLES
.. code-block:: sh
ALERTPORT=9093
__daemontools
__golang_from_vendor --version 1.8.1 # required for prometheus and many exporters
require="__daemontools __golang_from_vendor" __prometheus_alertmanager \
--with-daemontools \
--config "$__manifest/files/alertmanager.yml" \
--storage-path /data/alertmanager \
--listen-address "[::]:$ALERTPORT"
__prometheus_alertmanager \
--install-from-backports \
--config "$__manifest/files/alertmanager.yml" \
--storage-path /data/alertmanager
SEE ALSO
--------
:strong:`cdist-type__prometheus_server`\ (7), :strong:`cdist-type__daemontools`\ (7),
:strong:`cdist-type__prometheus_server`\ (7), :strong:`cdist-type__grafana_dashboard`\ (7),
Prometheus alerting documentation: https://prometheus.io/docs/alerting/overview/
AUTHORS
@ -61,7 +55,7 @@ Kamila Součková <kamila--@--ksp.sk>
COPYING
-------
Copyright \(C) 2017 Kamila Součková. You can redistribute it
Copyright \(C) 2018 Kamila Součková. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -0,0 +1,70 @@
cdist-type__prometheus_exporter(7)
==================================
NAME
----
cdist-type__prometheus_exporter - install some Prometheus exporters
DESCRIPTION
-----------
Install and configure some exporters to be used by the Prometheus monitoring system (https://prometheus.io/).
This type creates a daemontools-compatible service directory under /service/$__object_id.
Daemontools (or something compatible) must be installed (in particular, the command `svc` must be executable).
This type installs and builds the latest version from git, using go get. A recent version of golang as well
as build tools (make, g++, etc.) must be available.
Currently supported exporters:
- node
- blackbox
- ceph
REQUIRED PARAMETERS
-------------------
None
OPTIONAL PARAMETERS
-------------------
exporter
Which exporter to install and configure. Default: $__object_id.
Currently supported: node, blackbox, ceph.
BOOLEAN PARAMETERS
------------------
add-consul-service
Add this exporter as a Consul service for automatic service discovery.
EXAMPLES
--------
.. code-block:: sh
__daemontools
__golang_from_vendor --version 1.9 # required for prometheus and many exporters
require="__daemontools __golang_from_vendor" __prometheus_exporter node
SEE ALSO
--------
:strong:`cdist-type__daemontools`\ (7), :strong:`cdist-type__golang_from_vendor`\ (7),
:strong:`cdist-type__prometheus_server`\ (7),
Prometheus documentation: https://prometheus.io/docs/introduction/overview/
AUTHORS
-------
Kamila Součková <kamila--@--ksp.sk>
COPYING
-------
Copyright \(C) 2017 Kamila Součková. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -10,18 +10,12 @@ DESCRIPTION
-----------
Install and configure Prometheus (https://prometheus.io/).
This type creates a daemontools-compatible service directory under /service/prometheus.
Daemontools (or something compatible) must be installed (in particular, the command `svc` must be executable).
Note that due to significant differences between Prometheus 1.x and 2.x, only 2.x is supported. It is your responsibility to make sure that your package manager installs 2.x. (On Devuan Ascii, the parameter `--install-from-backports` helps.)
REQUIRED PARAMETERS
-------------------
config
Prometheus configuration file. It will be saved as /etc/prometheus/prometheus.yml on the target.
listen-address
Passed as web.listen-address.
alertmanager-url
Passed as alertmanager.url
OPTIONAL PARAMETERS
@ -32,13 +26,12 @@ rule-files
Path to rule files. They will be installed under /etc/prometheus/<filename>. You need to include `rule_files: [/etc/prometheus/<your-pattern>]` in the config file if you use this.
storage-path
Where to put data. Default: /data/prometheus. (Directory will be created if needed.)
target-heap-size
Passed as storage.local.target-heap-size. Default: 1/2 of RAM.
BOOLEAN PARAMETERS
------------------
None
install-from-backports
Valid on Devuan only. Will enable the backports apt source and install the package from there. Useful for getting a newer version.
EXAMPLES
@ -49,22 +42,17 @@ EXAMPLES
PROMPORT=9090
ALERTPORT=9093
__daemontools
__golang_from_vendor --version 1.8.1 # required for prometheus and many exporters
require="__daemontools __golang_from_vendor" __prometheus_server \
--with-daemontools \
__prometheus_server \
--install-from-backports \
--config "$__manifest/files/prometheus.yml" \
--retention-days 14 \
--storage-path /data/prometheus \
--listen-address "[::]:$PROMPORT" \
--rule-files "$__manifest/files/*.rules" \
--alertmanager-url "http://monitoring1.node.consul:$ALERTPORT,http://monitoring2.node.consul:$ALERTPORT"
--rule-files "$__manifest/files/*.rules"
SEE ALSO
--------
:strong:`cdist-type__prometheus_alertmanager`\ (7), :strong:`cdist-type__daemontools`\ (7),
:strong:`cdist-type__prometheus_alertmanager`\ (7), :strong:`cdist-type__grafana_dashboard`\ (7),
Prometheus documentation: https://prometheus.io/docs/introduction/overview/
AUTHORS
@ -73,7 +61,7 @@ Kamila Součková <kamila--@--ksp.sk>
COPYING
-------
Copyright \(C) 2017 Kamila Součková. You can redistribute it
Copyright \(C) 2018 Kamila Součková. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -36,6 +36,15 @@ state
if the given keys should be 'present' or 'absent', defaults to 'present'.
MESSAGES
--------
added to `file` (`entry`)
The key `entry` (with optional comment) was added to `file`.
removed from `file` (`entry`)
The key `entry` (with optional comment) was removed from `file`.
EXAMPLES
--------

View File

@ -0,0 +1,89 @@
cdist-type__systemd_unit(7)
===========================
NAME
----
cdist-type__systemd_unit - Install a systemd unit
DESCRIPTION
-----------
This type manages systemd units in ``/etc/systemd/system/``. It can install,
enable and start a systemd unit. This is particularly useful on systems which
take advantage of systemd heavily (e.g., CoreOS). For more information about
systemd units, see SYSTEMD.UNIT(5).
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
enablement-state
'enabled', 'disabled' or 'masked', where:
enabled
enables the unit
disabled
disables the unit
masked
masks the unit
source
Path to the config file. If source is '-' (dash), take what was written to
stdin as the config file content.
state
'present' or 'absent', defaults to 'present' where:
present
the unit (or its mask) is installed
absent
The unit is stopped, disabled and uninstalled. If the unit was masked,
the mask is removed.
BOOLEAN PARAMETERS
------------------
restart
Start the unit if it was inactive. Restart the unit if the unit file
changed. Stop the unit if new ``enablement-state`` is ``masked``.
MESSAGES
--------
None.
EXAMPLES
--------
.. code-block:: sh
# Installs, enables and starts foobar.service
__systemd_unit foobar.service \
--source "${__manifest}/files/foobar.service" \
--enablement-state enabled \
--restart
# Disables the unit
__systemd_unit foobar.service --enablement-state disabled
# Stops, disables and uninstalls foobar.service
__systemd_unit foobar.service --state absent
AUTHORS
-------
Ľubomír Kučera <lubomir.kucera.jr at gmail.com>
COPYING
-------
Copyright \(C) 2017 Ľubomír Kučera. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -60,6 +60,11 @@ mod
add
New user added
userdel -r
If user was deleted with homedir
userdel
If user was deleted (keeping homedir)
EXAMPLES
--------

View File

@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -81,10 +81,26 @@ div.sphinxsidebar input {
font-size: 1em;
}
div.sphinxsidebar #searchbox input[type="text"] {
width: 170px;
div.sphinxsidebar #searchbox form.search {
overflow: hidden;
}
div.sphinxsidebar #searchbox input[type="text"] {
float: left;
width: 80%;
padding: 0.25em;
box-sizing: border-box;
}
div.sphinxsidebar #searchbox input[type="submit"] {
float: left;
width: 20%;
border-left: none;
padding: 0.25em;
box-sizing: border-box;
}
img {
border: 0;
max-width: 100%;
@ -199,6 +215,11 @@ table.modindextable td {
/* -- general body styles --------------------------------------------------- */
div.body {
min-width: 450px;
max-width: 800px;
}
div.body p, div.body dd, div.body li, div.body blockquote {
-moz-hyphens: auto;
-ms-hyphens: auto;
@ -332,6 +353,11 @@ table.docutils {
border-collapse: collapse;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
table caption span.caption-number {
font-style: italic;
}
@ -405,6 +431,13 @@ table.field-list td, table.field-list th {
hyphens: manual;
}
/* -- hlist styles ---------------------------------------------------------- */
table.hlist td {
vertical-align: top;
}
/* -- other body styles ----------------------------------------------------- */
ol.arabic {
@ -445,10 +478,14 @@ dd {
margin-left: 30px;
}
dt:target, .highlighted {
dt:target, span.highlighted {
background-color: #fbe54e;
}
rect.highlighted {
fill: #fbe54e;
}
dl.glossary dt {
font-weight: bold;
font-size: 1.1em;

View File

@ -1,2 +1 @@
.fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../font/fontawesome_webfont.eot");src:url("../font/fontawesome_webfont.eot?#iefix") format("embedded-opentype"),url("../font/fontawesome_webfont.woff") format("woff"),url("../font/fontawesome_webfont.ttf") format("truetype"),url("../font/fontawesome_webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:0.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}
/*# sourceMappingURL=badge_only.css.map */
.fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../fonts/fontawesome-webfont.eot");src:url("../fonts/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff") format("woff"),url("../fonts/fontawesome-webfont.ttf") format("truetype"),url("../fonts/fontawesome-webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up{height:auto;max-height:100%}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -45,7 +45,7 @@ jQuery.urlencode = encodeURIComponent;
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s == 'undefined')
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
@ -66,29 +66,55 @@ jQuery.getQueryParameters = function(s) {
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node) {
if (node.nodeType == 3) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
var span = document.createElement("span");
span.className = className;
if (pos >= 0 &&
!jQuery(node.parentNode).hasClass(className) &&
!jQuery(node.parentNode).hasClass("nohighlight")) {
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var bbox = span.getBBox();
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
var parentOfText = node.parentNode.parentNode;
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this);
highlight(this, addItems);
});
}
}
return this.each(function() {
highlight(this);
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};
/*
@ -124,28 +150,30 @@ var Documentation = {
this.fixFirefoxAnchorBug();
this.highlightSearchWords();
this.initIndexTable();
if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) {
this.initOnKeyListeners();
}
},
/**
* i18n support
*/
TRANSLATIONS : {},
PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
LOCALE : 'unknown',
// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext : function(string) {
var translated = Documentation.TRANSLATIONS[string];
if (typeof translated == 'undefined')
if (typeof translated === 'undefined')
return string;
return (typeof translated == 'string') ? translated : translated[0];
return (typeof translated === 'string') ? translated : translated[0];
},
ngettext : function(singular, plural, n) {
var translated = Documentation.TRANSLATIONS[singular];
if (typeof translated == 'undefined')
if (typeof translated === 'undefined')
return (n == 1) ? singular : plural;
return translated[Documentation.PLURALEXPR(n)];
},
@ -180,7 +208,7 @@ var Documentation = {
* see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
*/
fixFirefoxAnchorBug : function() {
if (document.location.hash)
if (document.location.hash && $.browser.mozilla)
window.setTimeout(function() {
document.location.href += '';
}, 10);
@ -216,7 +244,7 @@ var Documentation = {
var src = $(this).attr('src');
var idnum = $(this).attr('id').substr(7);
$('tr.cg-' + idnum).toggle();
if (src.substr(-9) == 'minus.png')
if (src.substr(-9) === 'minus.png')
$(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
else
$(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
@ -248,7 +276,7 @@ var Documentation = {
var path = document.location.pathname;
var parts = path.split(/\//);
$.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
if (this == '..')
if (this === '..')
parts.pop();
});
var url = parts.join('/');
@ -284,4 +312,4 @@ _ = Documentation.gettext;
$(document).ready(function() {
Documentation.init();
});
});

View File

@ -0,0 +1,296 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '4.10.5-270-g0dc94fb5',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
NAVIGATION_WITH_KEYS: false,
SEARCH_LANGUAGE_STOP_WORDS: ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]
};
/* Non-minified version JS is _stemmer.js if file is provided */
/**
* Porter Stemmer
*/
var Stemmer = function() {
var step2list = {
ational: 'ate',
tional: 'tion',
enci: 'ence',
anci: 'ance',
izer: 'ize',
bli: 'ble',
alli: 'al',
entli: 'ent',
eli: 'e',
ousli: 'ous',
ization: 'ize',
ation: 'ate',
ator: 'ate',
alism: 'al',
iveness: 'ive',
fulness: 'ful',
ousness: 'ous',
aliti: 'al',
iviti: 'ive',
biliti: 'ble',
logi: 'log'
};
var step3list = {
icate: 'ic',
ative: '',
alize: 'al',
iciti: 'ic',
ical: 'ic',
ful: '',
ness: ''
};
var c = "[^aeiou]"; // consonant
var v = "[aeiouy]"; // vowel
var C = c + "[^aeiouy]*"; // consonant sequence
var V = v + "[aeiou]*"; // vowel sequence
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
var s_v = "^(" + C + ")?" + v; // vowel in stem
this.stemWord = function (w) {
var stem;
var suffix;
var firstch;
var origword = w;
if (w.length < 3)
return w;
var re;
var re2;
var re3;
var re4;
firstch = w.substr(0,1);
if (firstch == "y")
w = firstch.toUpperCase() + w.substr(1);
// Step 1a
re = /^(.+?)(ss|i)es$/;
re2 = /^(.+?)([^s])s$/;
if (re.test(w))
w = w.replace(re,"$1$2");
else if (re2.test(w))
w = w.replace(re2,"$1$2");
// Step 1b
re = /^(.+?)eed$/;
re2 = /^(.+?)(ed|ing)$/;
if (re.test(w)) {
var fp = re.exec(w);
re = new RegExp(mgr0);
if (re.test(fp[1])) {
re = /.$/;
w = w.replace(re,"");
}
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1];
re2 = new RegExp(s_v);
if (re2.test(stem)) {
w = stem;
re2 = /(at|bl|iz)$/;
re3 = new RegExp("([^aeiouylsz])\\1$");
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re2.test(w))
w = w + "e";
else if (re3.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
else if (re4.test(w))
w = w + "e";
}
}
// Step 1c
re = /^(.+?)y$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(s_v);
if (re.test(stem))
w = stem + "i";
}
// Step 2
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step2list[suffix];
}
// Step 3
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step3list[suffix];
}
// Step 4
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
re2 = /^(.+?)(s|t)(ion)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
if (re.test(stem))
w = stem;
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1] + fp[2];
re2 = new RegExp(mgr1);
if (re2.test(stem))
w = stem;
}
// Step 5
re = /^(.+?)e$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
re2 = new RegExp(meq1);
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
w = stem;
}
re = /ll$/;
re2 = new RegExp(mgr1);
if (re.test(w) && re2.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
// and turn initial Y back to y
if (firstch == "y")
w = firstch.toLowerCase() + w.substr(1);
return w;
}
}
var splitChars = (function() {
var result = {};
var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648,
1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702,
2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971,
2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345,
3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761,
3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823,
4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125,
8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695,
11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587,
43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141];
var i, j, start, end;
for (i = 0; i < singles.length; i++) {
result[singles[i]] = true;
}
var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709],
[722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161],
[1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568],
[1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807],
[1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047],
[2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383],
[2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450],
[2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547],
[2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673],
[2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820],
[2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946],
[2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023],
[3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173],
[3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332],
[3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481],
[3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718],
[3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791],
[3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095],
[4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205],
[4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687],
[4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968],
[4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869],
[5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102],
[6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271],
[6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592],
[6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822],
[6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167],
[7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959],
[7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143],
[8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318],
[8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483],
[8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101],
[10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567],
[11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292],
[12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444],
[12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783],
[12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311],
[19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511],
[42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774],
[42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071],
[43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263],
[43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519],
[43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647],
[43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967],
[44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295],
[57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274],
[64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007],
[65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381],
[65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]];
for (i = 0; i < ranges.length; i++) {
start = ranges[i][0];
end = ranges[i][1];
for (j = start; j <= end; j++) {
result[j] = true;
}
}
return result;
})();
function splitQuery(query) {
var result = [];
var start = -1;
for (var i = 0; i < query.length; i++) {
if (splitChars[query.charCodeAt(i)]) {
if (start !== -1) {
result.push(query.slice(start, i));
start = -1;
}
} else if (start === -1) {
start = i;
}
}
if (start !== -1) {
result.push(query.slice(start));
}
return result;
}

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 382 KiB

After

Width:  |  Height:  |  Size: 434 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,169 +1,3 @@
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"sphinx-rtd-theme":[function(require,module,exports){
var jQuery = (typeof(window) != 'undefined') ? window.jQuery : require('jquery');
// Sphinx theme nav state
function ThemeNav () {
var nav = {
navBar: null,
win: null,
winScroll: false,
winResize: false,
linkScroll: false,
winPosition: 0,
winHeight: null,
docHeight: null,
isRunning: false
};
nav.enable = function () {
var self = this;
if (!self.isRunning) {
self.isRunning = true;
jQuery(function ($) {
self.init($);
self.reset();
self.win.on('hashchange', self.reset);
// Set scroll monitor
self.win.on('scroll', function () {
if (!self.linkScroll) {
self.winScroll = true;
}
});
setInterval(function () { if (self.winScroll) self.onScroll(); }, 25);
// Set resize monitor
self.win.on('resize', function () {
self.winResize = true;
});
setInterval(function () { if (self.winResize) self.onResize(); }, 25);
self.onResize();
});
};
};
nav.init = function ($) {
var doc = $(document),
self = this;
this.navBar = $('div.wy-side-scroll:first');
this.win = $(window);
// Set up javascript UX bits
$(document)
// Shift nav in mobile when clicking the menu.
.on('click', "[data-toggle='wy-nav-top']", function() {
$("[data-toggle='wy-nav-shift']").toggleClass("shift");
$("[data-toggle='rst-versions']").toggleClass("shift");
})
// Nav menu link click operations
.on('click', ".wy-menu-vertical .current ul li a", function() {
var target = $(this);
// Close menu when you click a link.
$("[data-toggle='wy-nav-shift']").removeClass("shift");
$("[data-toggle='rst-versions']").toggleClass("shift");
// Handle dynamic display of l3 and l4 nav lists
self.toggleCurrent(target);
self.hashChange();
})
.on('click', "[data-toggle='rst-current-version']", function() {
$("[data-toggle='rst-versions']").toggleClass("shift-up");
})
// Make tables responsive
$("table.docutils:not(.field-list)")
.wrap("<div class='wy-table-responsive'></div>");
// Add expand links to all parents of nested ul
$('.wy-menu-vertical ul').not('.simple').siblings('a').each(function () {
var link = $(this);
expand = $('<span class="toctree-expand"></span>');
expand.on('click', function (ev) {
self.toggleCurrent(link);
ev.stopPropagation();
return false;
});
link.prepend(expand);
});
};
nav.reset = function () {
// Get anchor from URL and open up nested nav
var anchor = encodeURI(window.location.hash);
if (anchor) {
try {
var link = $('.wy-menu-vertical')
.find('[href="' + anchor + '"]');
// If we didn't find a link, it may be because we clicked on
// something that is not in the sidebar (eg: when using
// sphinxcontrib.httpdomain it generates headerlinks but those
// aren't picked up and placed in the toctree). So let's find
// the closest header in the document and try with that one.
if (link.length === 0) {
var doc_link = $('.document a[href="' + anchor + '"]');
var closest_section = doc_link.closest('div.section');
// Try again with the closest section entry.
link = $('.wy-menu-vertical')
.find('[href="#' + closest_section.attr("id") + '"]');
}
$('.wy-menu-vertical li.toctree-l1 li.current')
.removeClass('current');
link.closest('li.toctree-l2').addClass('current');
link.closest('li.toctree-l3').addClass('current');
link.closest('li.toctree-l4').addClass('current');
}
catch (err) {
console.log("Error expanding nav for anchor", err);
}
}
};
nav.onScroll = function () {
this.winScroll = false;
var newWinPosition = this.win.scrollTop(),
winBottom = newWinPosition + this.winHeight,
navPosition = this.navBar.scrollTop(),
newNavPosition = navPosition + (newWinPosition - this.winPosition);
if (newWinPosition < 0 || winBottom > this.docHeight) {
return;
}
this.navBar.scrollTop(newNavPosition);
this.winPosition = newWinPosition;
};
nav.onResize = function () {
this.winResize = false;
this.winHeight = this.win.height();
this.docHeight = $(document).height();
};
nav.hashChange = function () {
this.linkScroll = true;
this.win.one('hashchange', function () {
this.linkScroll = false;
});
};
nav.toggleCurrent = function (elem) {
var parent_li = elem.closest('li');
parent_li.siblings('li.current').removeClass('current');
parent_li.siblings().find('li.current').removeClass('current');
parent_li.find('> ul li.current').removeClass('current');
parent_li.toggleClass('current');
}
return nav;
};
module.exports.ThemeNav = ThemeNav();
if (typeof(window) != 'undefined') {
window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav };
}
},{"jquery":"jquery"}]},{},["sphinx-rtd-theme"]);
/* sphinx_rtd_theme version 0.4.2 | MIT license */
/* Built 20181005 13:10 */
require=function r(s,a,l){function c(e,n){if(!a[e]){if(!s[e]){var i="function"==typeof require&&require;if(!n&&i)return i(e,!0);if(u)return u(e,!0);var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}var o=a[e]={exports:{}};s[e][0].call(o.exports,function(n){return c(s[e][1][n]||n)},o,o.exports,r,s,a,l)}return a[e].exports}for(var u="function"==typeof require&&require,n=0;n<l.length;n++)c(l[n]);return c}({"sphinx-rtd-theme":[function(n,e,i){var jQuery="undefined"!=typeof window?window.jQuery:n("jquery");e.exports.ThemeNav={navBar:null,win:null,winScroll:!1,winResize:!1,linkScroll:!1,winPosition:0,winHeight:null,docHeight:null,isRunning:!1,enable:function(e){var i=this;void 0===e&&(e=!0),i.isRunning||(i.isRunning=!0,jQuery(function(n){i.init(n),i.reset(),i.win.on("hashchange",i.reset),e&&i.win.on("scroll",function(){i.linkScroll||i.winScroll||(i.winScroll=!0,requestAnimationFrame(function(){i.onScroll()}))}),i.win.on("resize",function(){i.winResize||(i.winResize=!0,requestAnimationFrame(function(){i.onResize()}))}),i.onResize()}))},enableSticky:function(){this.enable(!0)},init:function(i){i(document);var t=this;this.navBar=i("div.wy-side-scroll:first"),this.win=i(window),i(document).on("click","[data-toggle='wy-nav-top']",function(){i("[data-toggle='wy-nav-shift']").toggleClass("shift"),i("[data-toggle='rst-versions']").toggleClass("shift")}).on("click",".wy-menu-vertical .current ul li a",function(){var n=i(this);i("[data-toggle='wy-nav-shift']").removeClass("shift"),i("[data-toggle='rst-versions']").toggleClass("shift"),t.toggleCurrent(n),t.hashChange()}).on("click","[data-toggle='rst-current-version']",function(){i("[data-toggle='rst-versions']").toggleClass("shift-up")}),i("table.docutils:not(.field-list,.footnote,.citation)").wrap("<div class='wy-table-responsive'></div>"),i("table.docutils.footnote").wrap("<div class='wy-table-responsive footnote'></div>"),i("table.docutils.citation").wrap("<div class='wy-table-responsive citation'></div>"),i(".wy-menu-vertical ul").not(".simple").siblings("a").each(function(){var e=i(this);expand=i('<span class="toctree-expand"></span>'),expand.on("click",function(n){return t.toggleCurrent(e),n.stopPropagation(),!1}),e.prepend(expand)})},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),i=e.find('[href="'+n+'"]');if(0===i.length){var t=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(i=e.find('[href="#'+t.attr("id")+'"]')).length&&(i=e.find('[href="#"]'))}0<i.length&&($(".wy-menu-vertical .current").removeClass("current"),i.addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l1").parent().addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l2").addClass("current"),i.closest("li.toctree-l3").addClass("current"),i.closest("li.toctree-l4").addClass("current"))}catch(o){console.log("Error expanding nav for anchor",o)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,i=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(i),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",function(){this.linkScroll=!1})},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current"),e.siblings().find("li.current").removeClass("current"),e.find("> ul li.current").removeClass("current"),e.toggleClass("current")}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:e.exports.ThemeNav,StickyNav:e.exports.ThemeNav}),function(){for(var r=0,n=["ms","moz","webkit","o"],e=0;e<n.length&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[n[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[n[e]+"CancelAnimationFrame"]||window[n[e]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(n,e){var i=(new Date).getTime(),t=Math.max(0,16-(i-r)),o=window.setTimeout(function(){n(i+t)},t);return r=i+t,o}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(n){clearTimeout(n)})}()},{jquery:"jquery"}]},{},["sphinx-rtd-theme"]);

View File

@ -1,331 +1,52 @@
/*
* searchtools.js_t
* searchtools.js
* ~~~~~~~~~~~~~~~~
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
if (!Scorer) {
/**
* Simple result scoring code.
*/
var Scorer = {
// Implement the following function to further tweak the score for each result
// The function takes a result array [filename, title, anchor, descr, score]
// and returns the new score.
/*
score: function(result) {
return result[4];
},
*/
/* Non-minified version JS is _stemmer.js if file is provided */
/**
* Porter Stemmer
*/
var Stemmer = function() {
// query matches the full name of an object
objNameMatch: 11,
// or matches in the last dotted part of the object name
objPartialMatch: 6,
// Additive scores depending on the priority of the object
objPrio: {0: 15, // used to be importantResults
1: 5, // used to be objectResults
2: -5}, // used to be unimportantResults
// Used when the priority is not in the mapping.
objPrioDefault: 0,
var step2list = {
ational: 'ate',
tional: 'tion',
enci: 'ence',
anci: 'ance',
izer: 'ize',
bli: 'ble',
alli: 'al',
entli: 'ent',
eli: 'e',
ousli: 'ous',
ization: 'ize',
ation: 'ate',
ator: 'ate',
alism: 'al',
iveness: 'ive',
fulness: 'ful',
ousness: 'ous',
aliti: 'al',
iviti: 'ive',
biliti: 'ble',
logi: 'log'
// query found in title
title: 15,
// query found in terms
term: 5
};
}
var step3list = {
icate: 'ic',
ative: '',
alize: 'al',
iciti: 'ic',
ical: 'ic',
ful: '',
ness: ''
};
var c = "[^aeiou]"; // consonant
var v = "[aeiouy]"; // vowel
var C = c + "[^aeiouy]*"; // consonant sequence
var V = v + "[aeiou]*"; // vowel sequence
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
var s_v = "^(" + C + ")?" + v; // vowel in stem
this.stemWord = function (w) {
var stem;
var suffix;
var firstch;
var origword = w;
if (w.length < 3)
return w;
var re;
var re2;
var re3;
var re4;
firstch = w.substr(0,1);
if (firstch == "y")
w = firstch.toUpperCase() + w.substr(1);
// Step 1a
re = /^(.+?)(ss|i)es$/;
re2 = /^(.+?)([^s])s$/;
if (re.test(w))
w = w.replace(re,"$1$2");
else if (re2.test(w))
w = w.replace(re2,"$1$2");
// Step 1b
re = /^(.+?)eed$/;
re2 = /^(.+?)(ed|ing)$/;
if (re.test(w)) {
var fp = re.exec(w);
re = new RegExp(mgr0);
if (re.test(fp[1])) {
re = /.$/;
w = w.replace(re,"");
}
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1];
re2 = new RegExp(s_v);
if (re2.test(stem)) {
w = stem;
re2 = /(at|bl|iz)$/;
re3 = new RegExp("([^aeiouylsz])\\1$");
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re2.test(w))
w = w + "e";
else if (re3.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
else if (re4.test(w))
w = w + "e";
}
}
// Step 1c
re = /^(.+?)y$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(s_v);
if (re.test(stem))
w = stem + "i";
}
// Step 2
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step2list[suffix];
}
// Step 3
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step3list[suffix];
}
// Step 4
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
re2 = /^(.+?)(s|t)(ion)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
if (re.test(stem))
w = stem;
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1] + fp[2];
re2 = new RegExp(mgr1);
if (re2.test(stem))
w = stem;
}
// Step 5
re = /^(.+?)e$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
re2 = new RegExp(meq1);
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
w = stem;
}
re = /ll$/;
re2 = new RegExp(mgr1);
if (re.test(w) && re2.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
// and turn initial Y back to y
if (firstch == "y")
w = firstch.toLowerCase() + w.substr(1);
return w;
if (!splitQuery) {
function splitQuery(query) {
return query.split(/\s+/);
}
}
/**
* Simple result scoring code.
*/
var Scorer = {
// Implement the following function to further tweak the score for each result
// The function takes a result array [filename, title, anchor, descr, score]
// and returns the new score.
/*
score: function(result) {
return result[4];
},
*/
// query matches the full name of an object
objNameMatch: 11,
// or matches in the last dotted part of the object name
objPartialMatch: 6,
// Additive scores depending on the priority of the object
objPrio: {0: 15, // used to be importantResults
1: 5, // used to be objectResults
2: -5}, // used to be unimportantResults
// Used when the priority is not in the mapping.
objPrioDefault: 0,
// query found in title
title: 15,
// query found in terms
term: 5
};
var splitChars = (function() {
var result = {};
var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648,
1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702,
2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971,
2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345,
3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761,
3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823,
4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125,
8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695,
11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587,
43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141];
var i, j, start, end;
for (i = 0; i < singles.length; i++) {
result[singles[i]] = true;
}
var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709],
[722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161],
[1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568],
[1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807],
[1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047],
[2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383],
[2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450],
[2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547],
[2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673],
[2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820],
[2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946],
[2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023],
[3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173],
[3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332],
[3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481],
[3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718],
[3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791],
[3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095],
[4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205],
[4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687],
[4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968],
[4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869],
[5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102],
[6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271],
[6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592],
[6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822],
[6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167],
[7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959],
[7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143],
[8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318],
[8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483],
[8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101],
[10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567],
[11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292],
[12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444],
[12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783],
[12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311],
[19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511],
[42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774],
[42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071],
[43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263],
[43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519],
[43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647],
[43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967],
[44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295],
[57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274],
[64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007],
[65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381],
[65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]];
for (i = 0; i < ranges.length; i++) {
start = ranges[i][0];
end = ranges[i][1];
for (j = start; j <= end; j++) {
result[j] = true;
}
}
return result;
})();
function splitQuery(query) {
var result = [];
var start = -1;
for (var i = 0; i < query.length; i++) {
if (splitChars[query.charCodeAt(i)]) {
if (start !== -1) {
result.push(query.slice(start, i));
start = -1;
}
} else if (start === -1) {
start = i;
}
}
if (start !== -1) {
result.push(query.slice(start));
}
return result;
}
/**
* Search Module
*/
@ -417,7 +138,7 @@ var Search = {
*/
query : function(query) {
var i;
var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
var stopwords = DOCUMENTATION_OPTIONS.SEARCH_LANGUAGE_STOP_WORDS;
// stem the searchterms and add them to the correct list
var stemmer = new Stemmer();
@ -540,6 +261,9 @@ var Search = {
});
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX;
if (suffix === undefined) {
suffix = '.txt';
}
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix),
dataType: "text",
complete: function(jqxhr, textstatus) {
@ -755,4 +479,4 @@ var Search = {
$(document).ready(function() {
Search.init();
});
});

View File

@ -4,7 +4,7 @@
*
* sphinx.websupport utilities for all documentation.
*
* :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -301,7 +301,7 @@
li.hide();
// Determine where in the parents children list to insert this comment.
for(i=0; i < siblings.length; i++) {
for(var i=0; i < siblings.length; i++) {
if (comp(comment, siblings[i]) <= 0) {
$('#cd' + siblings[i].id)
.parent()

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>21. Best practice &mdash; cdist 4.5.0 documentation</title>
<title>24. Best practice &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="22. Execution stages" href="cdist-stages.html"/>
<link rel="prev" title="20. Reference" href="cdist-reference.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="25. Execution stages" href="cdist-stages.html" />
<link rel="prev" title="23. Reference" href="cdist-reference.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,35 +91,40 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">21. Best practice</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#passwordless-connections">21.1. Passwordless connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="#speeding-up-ssh-connections">21.2. Speeding up ssh connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="#speeding-up-shell-execution">21.3. Speeding up shell execution</a></li>
<li class="toctree-l2"><a class="reference internal" href="#multi-master-or-environment-setups">21.4. Multi master or environment setups</a></li>
<li class="toctree-l2"><a class="reference internal" href="#separating-work-by-groups">21.5. Separating work by groups</a></li>
<li class="toctree-l2"><a class="reference internal" href="#maintaining-multiple-configurations">21.6. Maintaining multiple configurations</a></li>
<li class="toctree-l2"><a class="reference internal" href="#multiple-developers-with-different-trust">21.7. Multiple developers with different trust</a></li>
<li class="toctree-l2"><a class="reference internal" href="#templating">21.8. Templating</a></li>
<li class="toctree-l2"><a class="reference internal" href="#testing-a-new-type">21.9. Testing a new type</a></li>
<li class="toctree-l2"><a class="reference internal" href="#other-content-in-cdist-repository">21.10. Other content in cdist repository</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">24. Best practice</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#passwordless-connections">24.1. Passwordless connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="#speeding-up-ssh-connections">24.2. Speeding up ssh connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="#speeding-up-shell-execution">24.3. Speeding up shell execution</a></li>
<li class="toctree-l2"><a class="reference internal" href="#multi-master-or-environment-setups">24.4. Multi master or environment setups</a></li>
<li class="toctree-l2"><a class="reference internal" href="#separating-work-by-groups">24.5. Separating work by groups</a></li>
<li class="toctree-l2"><a class="reference internal" href="#maintaining-multiple-configurations">24.6. Maintaining multiple configurations</a></li>
<li class="toctree-l2"><a class="reference internal" href="#multiple-developers-with-different-trust">24.7. Multiple developers with different trust</a></li>
<li class="toctree-l2"><a class="reference internal" href="#templating">24.8. Templating</a></li>
<li class="toctree-l2"><a class="reference internal" href="#testing-a-new-type">24.9. Testing a new type</a></li>
<li class="toctree-l2"><a class="reference internal" href="#other-content-in-cdist-repository">24.10. Other content in cdist repository</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -139,7 +136,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -147,9 +144,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -172,7 +170,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>21. Best practice</li>
<li>24. Best practice</li>
<li class="wy-breadcrumbs-aside">
@ -192,45 +190,45 @@
<div itemprop="articleBody">
<div class="section" id="best-practice">
<h1>21. Best practice<a class="headerlink" href="#best-practice" title="Permalink to this headline"></a></h1>
<h1>24. Best practice<a class="headerlink" href="#best-practice" title="Permalink to this headline"></a></h1>
<p>Practices used in real environments</p>
<div class="section" id="passwordless-connections">
<h2>21.1. Passwordless connections<a class="headerlink" href="#passwordless-connections" title="Permalink to this headline"></a></h2>
<h2>24.1. Passwordless connections<a class="headerlink" href="#passwordless-connections" title="Permalink to this headline"></a></h2>
<p>It is recommended to run cdist with public key authentication.
This requires a private/public key pair and the entry
&quot;PermitRootLogin without-password&quot; in the sshd server.
See sshd_config(5) and ssh-keygen(1).</p>
</div>
<div class="section" id="speeding-up-ssh-connections">
<h2>21.2. Speeding up ssh connections<a class="headerlink" href="#speeding-up-ssh-connections" title="Permalink to this headline"></a></h2>
<h2>24.2. Speeding up ssh connections<a class="headerlink" href="#speeding-up-ssh-connections" title="Permalink to this headline"></a></h2>
<p>When connecting to a new host, the initial delay with ssh connections
is pretty big. You can work around this by
&quot;sharing of multiple sessions over a single network connection&quot;
(quote from ssh_config(5)). The following code is suitable for
inclusion into your ~/.ssh/config:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">Host</span> <span class="o">*</span>
<span class="n">ControlPath</span> <span class="o">~/.</span><span class="n">ssh</span><span class="o">/</span><span class="n">master</span><span class="o">-%</span><span class="n">l</span><span class="o">-%</span><span class="n">r</span><span class="o">@%</span><span class="n">h</span><span class="p">:</span><span class="o">%</span><span class="n">p</span>
<span class="n">ControlMaster</span> <span class="n">auto</span>
<span class="n">ControlPersist</span> <span class="mi">10</span>
</pre></div>
</div>
is pretty big. As cdist makes many connections to each host successive
connections can be sped up by &quot;sharing of multiple sessions over a single
network connection&quot; (quote from ssh_config(5)). This is also called &quot;connection
multiplexing&quot;.</p>
<p>Cdist implements this since v4.0.0 by executing ssh with the appropriate
options (<cite>-o ControlMaster=auto -o ControlPath=/tmp/&lt;tmpdir&gt;/s -o
ControlPersist=2h</cite>).</p>
<p>Note that the sshd_config on the server can configure the maximum number of
parallel multiplexed connections this with <cite>MaxSessions N</cite> (N defaults to 10
for OpenSSH v7.4).</p>
</div>
<div class="section" id="speeding-up-shell-execution">
<h2>21.3. Speeding up shell execution<a class="headerlink" href="#speeding-up-shell-execution" title="Permalink to this headline"></a></h2>
<h2>24.3. Speeding up shell execution<a class="headerlink" href="#speeding-up-shell-execution" title="Permalink to this headline"></a></h2>
<p>On the source host, ensure that /bin/sh is <em>not</em> bash: bash is quite slow for
script execution. Instead, you could use dash after installing it:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">ln</span> <span class="o">-</span><span class="n">sf</span> <span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">dash</span> <span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">sh</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ln</span> <span class="o">-</span><span class="n">sf</span> <span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">dash</span> <span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">sh</span>
</pre></div>
</div>
</div>
<div class="section" id="multi-master-or-environment-setups">
<h2>21.4. Multi master or environment setups<a class="headerlink" href="#multi-master-or-environment-setups" title="Permalink to this headline"></a></h2>
<h2>24.4. Multi master or environment setups<a class="headerlink" href="#multi-master-or-environment-setups" title="Permalink to this headline"></a></h2>
<p>If you plan to distribute cdist among servers or use different
environments, you can do so easily with the included version
control git. For instance if you plan to use the typical three
environments production, integration and development, you can
realise this with git branches:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Go to cdist checkout</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Go to cdist checkout</span>
<span class="n">cd</span> <span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">cdist</span>
<span class="c1"># Create branches</span>
@ -244,18 +242,18 @@ realise this with git branches:</p>
</div>
<p>Similar if you want to have cdist checked out at multiple machines,
you can clone it multiple times:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">machine</span><span class="o">-</span><span class="n">a</span> <span class="o">%</span> <span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="p">:</span><span class="o">//</span><span class="n">your</span><span class="o">-</span><span class="n">git</span><span class="o">-</span><span class="n">server</span><span class="o">/</span><span class="n">cdist</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">machine</span><span class="o">-</span><span class="n">a</span> <span class="o">%</span> <span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="p">:</span><span class="o">//</span><span class="n">your</span><span class="o">-</span><span class="n">git</span><span class="o">-</span><span class="n">server</span><span class="o">/</span><span class="n">cdist</span>
<span class="n">machine</span><span class="o">-</span><span class="n">b</span> <span class="o">%</span> <span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="p">:</span><span class="o">//</span><span class="n">your</span><span class="o">-</span><span class="n">git</span><span class="o">-</span><span class="n">server</span><span class="o">/</span><span class="n">cdist</span>
</pre></div>
</div>
</div>
<div class="section" id="separating-work-by-groups">
<h2>21.5. Separating work by groups<a class="headerlink" href="#separating-work-by-groups" title="Permalink to this headline"></a></h2>
<h2>24.5. Separating work by groups<a class="headerlink" href="#separating-work-by-groups" title="Permalink to this headline"></a></h2>
<p>If you are working with different groups on one cdist-configuration,
you can delegate to other manifests and have the groups edit only
their manifests. You can use the following snippet in
<strong>conf/manifests/init</strong>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Include other groups</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Include other groups</span>
<span class="n">sh</span> <span class="o">-</span><span class="n">e</span> <span class="s2">&quot;$__manifest/systems&quot;</span>
<span class="n">sh</span> <span class="o">-</span><span class="n">e</span> <span class="s2">&quot;$__manifest/cbrg&quot;</span>
@ -263,11 +261,11 @@ their manifests. You can use the following snippet in
</div>
</div>
<div class="section" id="maintaining-multiple-configurations">
<h2>21.6. Maintaining multiple configurations<a class="headerlink" href="#maintaining-multiple-configurations" title="Permalink to this headline"></a></h2>
<h2>24.6. Maintaining multiple configurations<a class="headerlink" href="#maintaining-multiple-configurations" title="Permalink to this headline"></a></h2>
<p>When you need to manage multiple sites with cdist, like company_a, company_b
and private for instance, you can easily use git for this purpose.
Including a possible common base that is reused across the different sites:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># create branches</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># create branches</span>
<span class="n">git</span> <span class="n">branch</span> <span class="n">company_a</span> <span class="n">company_b</span> <span class="n">common</span> <span class="n">private</span>
<span class="c1"># make stuff for company a</span>
@ -288,7 +286,7 @@ Including a possible common base that is reused across the different sites:</p>
</pre></div>
</div>
<p>The following <strong>.git/config</strong> is taken from a real world scenario:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Track upstream, merge from time to time</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Track upstream, merge from time to time</span>
<span class="p">[</span><span class="n">remote</span> <span class="s2">&quot;upstream&quot;</span><span class="p">]</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">git</span><span class="p">:</span><span class="o">//</span><span class="n">git</span><span class="o">.</span><span class="n">schottelius</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">cdist</span>
<span class="n">fetch</span> <span class="o">=</span> <span class="o">+</span><span class="n">refs</span><span class="o">/</span><span class="n">heads</span><span class="o">/*</span><span class="p">:</span><span class="n">refs</span><span class="o">/</span><span class="n">remotes</span><span class="o">/</span><span class="n">upstream</span><span class="o">/*</span>
@ -322,7 +320,7 @@ Including a possible common base that is reused across the different sites:</p>
<p>Have a look at git-remote(1) to adjust the remote configuration, which allows</p>
</div>
<div class="section" id="multiple-developers-with-different-trust">
<h2>21.7. Multiple developers with different trust<a class="headerlink" href="#multiple-developers-with-different-trust" title="Permalink to this headline"></a></h2>
<h2>24.7. Multiple developers with different trust<a class="headerlink" href="#multiple-developers-with-different-trust" title="Permalink to this headline"></a></h2>
<p>If you are working in an environment that requires different people to
work on the same configuration, but having different privileges, you can
implement this scenario with a gateway host and sudo:</p>
@ -346,12 +344,12 @@ implement this scenario with a gateway host and sudo:</p>
<p>For more details consult sudoers(5)</p>
</div>
<div class="section" id="templating">
<h2>21.8. Templating<a class="headerlink" href="#templating" title="Permalink to this headline"></a></h2>
<h2>24.8. Templating<a class="headerlink" href="#templating" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>create directory files/ in your type (convention)</li>
<li>create the template as an executable file like files/basic.conf.sh, it will output text using shell variables for the values</li>
</ul>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="ch">#!/bin/sh</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="ch">#!/bin/sh</span>
<span class="c1"># in the template, use cat &lt;&lt; eof (here document) to output the text</span>
<span class="c1"># and use standard shell variables in the template</span>
<span class="c1"># output everything in the template script to stdout</span>
@ -370,7 +368,7 @@ cat <span class="s">&lt;&lt; EOF</span>
<ul class="simple">
<li>in the manifest, export the relevant variables and add the following lines to your manifest:</li>
</ul>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">#</span> <span class="nb">export</span> variables needed <span class="k">for</span> the template
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">#</span> <span class="nb">export</span> variables needed <span class="k">for</span> the template
<span class="go"> export SERVERNAME=&#39;test&quot;</span>
<span class="go"> export ROOT=&#39;/var/www/test&#39;</span>
<span class="gp">#</span> render the template
@ -384,12 +382,12 @@ cat <span class="s">&lt;&lt; EOF</span>
</div>
</div>
<div class="section" id="testing-a-new-type">
<h2>21.9. Testing a new type<a class="headerlink" href="#testing-a-new-type" title="Permalink to this headline"></a></h2>
<h2>24.9. Testing a new type<a class="headerlink" href="#testing-a-new-type" title="Permalink to this headline"></a></h2>
<p>If you want to test a new type on a node, you can tell cdist to only use an
object of this type: Use the '--initial-manifest' parameter
with - (stdin) as argument and feed object into stdin
of cdist:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># Singleton type without parameter</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Singleton type without parameter</span>
<span class="nb">echo</span> __ungleich_munin_server <span class="p">|</span> cdist --initial-manifest - munin.panter.ch
<span class="c1"># Singleton type with parameter</span>
@ -403,7 +401,7 @@ of cdist:</p>
</div>
</div>
<div class="section" id="other-content-in-cdist-repository">
<h2>21.10. Other content in cdist repository<a class="headerlink" href="#other-content-in-cdist-repository" title="Permalink to this headline"></a></h2>
<h2>24.10. Other content in cdist repository<a class="headerlink" href="#other-content-in-cdist-repository" title="Permalink to this headline"></a></h2>
<p>Usually the cdist repository contains all configuration
items. Sometimes you may have additional resources that
you would like to store in your central configuration
@ -419,18 +417,16 @@ repository.</p>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-stages.html" class="btn btn-neutral float-right" title="22. Execution stages" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-stages.html" class="btn btn-neutral float-right" title="25. Execution stages" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-reference.html" class="btn btn-neutral" title="20. Reference" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="cdist-reference.html" class="btn btn-neutral" title="23. Reference" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -439,11 +435,11 @@ repository.</p>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -458,35 +454,24 @@ repository.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>10. Bootstrap &mdash; cdist 4.5.0 documentation</title>
<title>11. Bootstrap &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="11. Manifest" href="cdist-manifest.html"/>
<link rel="prev" title="9. cdist(1)" href="man1/cdist.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="12. Configuration" href="cdist-configuration.html" />
<link rel="prev" title="10. cdist(1)" href="man1/cdist.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,29 +91,34 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">10. Bootstrap</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#location">10.1. Location</a></li>
<li class="toctree-l2"><a class="reference internal" href="#setup-working-directory-and-branch">10.2. Setup working directory and branch</a></li>
<li class="toctree-l2"><a class="reference internal" href="#publishing-the-configuration">10.3. Publishing the configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="#updating-from-origin">10.4. Updating from origin</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">11. Bootstrap</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#location">11.1. Location</a></li>
<li class="toctree-l2"><a class="reference internal" href="#setup-working-directory-and-branch">11.2. Setup working directory and branch</a></li>
<li class="toctree-l2"><a class="reference internal" href="#publishing-the-configuration">11.3. Publishing the configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="#updating-from-origin">11.4. Updating from origin</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -133,7 +130,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -141,9 +138,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -166,7 +164,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>10. Bootstrap</li>
<li>11. Bootstrap</li>
<li class="wy-breadcrumbs-aside">
@ -186,12 +184,12 @@
<div itemprop="articleBody">
<div class="section" id="bootstrap">
<h1>10. Bootstrap<a class="headerlink" href="#bootstrap" title="Permalink to this headline"></a></h1>
<h1>11. Bootstrap<a class="headerlink" href="#bootstrap" title="Permalink to this headline"></a></h1>
<p>This document describes the usual steps recommended for a new
cdist setup. It is recommended that you have read and understood
<a class="reference external" href="cdist-quickstart.html">cdist quickstart</a> before digging into this.</p>
<div class="section" id="location">
<h2>10.1. Location<a class="headerlink" href="#location" title="Permalink to this headline"></a></h2>
<h2>11.1. Location<a class="headerlink" href="#location" title="Permalink to this headline"></a></h2>
<p>First of all, you should think about where to store your configuration
database and who will be accessing or changing it. Secondly you have to
think about where to configure your hosts from, which may be a different
@ -205,7 +203,7 @@ with others.</p>
people, have a look at <a class="reference external" href="cdist-best-practice.html">cdist best practice</a>.</p>
</div>
<div class="section" id="setup-working-directory-and-branch">
<h2>10.2. Setup working directory and branch<a class="headerlink" href="#setup-working-directory-and-branch" title="Permalink to this headline"></a></h2>
<h2>11.2. Setup working directory and branch<a class="headerlink" href="#setup-working-directory-and-branch" title="Permalink to this headline"></a></h2>
<p>I assume you have a fresh copy of the cdist tree in ~/cdist, cloned from
one of the official urls (see <a class="reference external" href="cdist-quickstart.html">cdist quickstart</a> if you don't).
Entering the command &quot;git branch&quot; should show you &quot;* master&quot;, which indicates
@ -214,7 +212,7 @@ you are on the <strong>master</strong> branch.</p>
development branch, it may or may not work. There are also version branches
available, which are kept in a stable state. Let's use <strong>git branch -r</strong>
to list all branches:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">branch</span> <span class="o">-</span><span class="n">r</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">branch</span> <span class="o">-</span><span class="n">r</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.0</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.1</span>
<span class="n">origin</span><span class="o">/</span><span class="mf">1.2</span>
@ -242,7 +240,7 @@ your own work. Now it's time to create your branch, which contains your
local changes. I usually name it by the company/area I am working for:
ethz-systems, localch, customerX, ... But this is pretty much up to you.</p>
<p>In this tutorial I use the branch <strong>mycompany</strong>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">checkout</span> <span class="o">-</span><span class="n">b</span> <span class="n">mycompany</span> <span class="n">origin</span><span class="o">/</span><span class="n">master</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">checkout</span> <span class="o">-</span><span class="n">b</span> <span class="n">mycompany</span> <span class="n">origin</span><span class="o">/</span><span class="n">master</span>
<span class="n">Branch</span> <span class="n">mycompany</span> <span class="nb">set</span> <span class="n">up</span> <span class="n">to</span> <span class="n">track</span> <span class="n">remote</span> <span class="n">branch</span> <span class="n">master</span> <span class="kn">from</span> <span class="nn">origin.</span>
<span class="n">Switched</span> <span class="n">to</span> <span class="n">a</span> <span class="n">new</span> <span class="n">branch</span> <span class="s1">&#39;mycompany&#39;</span>
<span class="n">cdist</span><span class="o">-</span><span class="n">user</span><span class="o">%</span> <span class="n">git</span> <span class="n">branch</span>
@ -253,13 +251,13 @@ ethz-systems, localch, customerX, ... But this is pretty much up to you.</p>
<p>From now on, you can use git as usual to commit your changes in your own branch.</p>
</div>
<div class="section" id="publishing-the-configuration">
<h2>10.3. Publishing the configuration<a class="headerlink" href="#publishing-the-configuration" title="Permalink to this headline"></a></h2>
<h2>11.3. Publishing the configuration<a class="headerlink" href="#publishing-the-configuration" title="Permalink to this headline"></a></h2>
<p>Usually a development machine like a notebook should be considered
temporary only. For this reason and to enable shareability, the configuration
should be published to another device as early as possible. The following
example shows how to publish the configuration to another host that is
reachable via ssh and has git installed:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Create bare git repository on the host named &quot;loch&quot;</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Create bare git repository on the host named &quot;loch&quot;</span>
<span class="n">cdist</span><span class="o">%</span> <span class="n">ssh</span> <span class="n">loch</span> <span class="s2">&quot;GIT_DIR=/home/nutzer/cdist git init&quot;</span>
<span class="n">Initialized</span> <span class="n">empty</span> <span class="n">Git</span> <span class="n">repository</span> <span class="ow">in</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">nutzer</span><span class="o">/</span><span class="n">cdist</span><span class="o">/</span>
@ -281,9 +279,9 @@ branch with the <strong>master</strong> branch on the host <strong>loch</strong>
as usual in your branch and push out changes by entering <strong>git push</strong>.</p>
</div>
<div class="section" id="updating-from-origin">
<h2>10.4. Updating from origin<a class="headerlink" href="#updating-from-origin" title="Permalink to this headline"></a></h2>
<h2>11.4. Updating from origin<a class="headerlink" href="#updating-from-origin" title="Permalink to this headline"></a></h2>
<p>Whenever you want to update your cdist installation, you can use git to do so:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Update git repository with latest changes from origin</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Update git repository with latest changes from origin</span>
<span class="n">cdist</span><span class="o">%</span> <span class="n">git</span> <span class="n">fetch</span> <span class="n">origin</span>
<span class="c1"># Update current branch with master branch from origin</span>
@ -298,18 +296,16 @@ as usual in your branch and push out changes by entering <strong>git push</stron
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-manifest.html" class="btn btn-neutral float-right" title="11. Manifest" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-configuration.html" class="btn btn-neutral float-right" title="12. Configuration" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="man1/cdist.html" class="btn btn-neutral" title="9. cdist(1)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="man1/cdist.html" class="btn btn-neutral" title="10. cdist(1)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -318,11 +314,11 @@ as usual in your branch and push out changes by entering <strong>git push</stron
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -337,35 +333,24 @@ as usual in your branch and push out changes by entering <strong>git push</stron
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -0,0 +1,326 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>26. Local cache overview &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="27. Saving output streams" href="cdist-saving-output-streams.html" />
<link rel="prev" title="25. Execution stages" href="cdist-stages.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> cdist
</a>
<div class="version">
4.10.5-270-g0dc94fb5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="cdist-intro.html">1. cdist - usable configuration management</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-why.html">2. Why should I use cdist?</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-os.html">3. Supported Operating Systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-install.html">4. How to install cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-update.html">5. How to update cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">26. Local cache overview</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">26.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#cache-overview">26.2. Cache overview</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#object-cache-overview">26.2.1. Object cache overview</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>26. Local cache overview</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/cdist-cache.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="local-cache-overview">
<h1>26. Local cache overview<a class="headerlink" href="#local-cache-overview" title="Permalink to this headline"></a></h1>
<div class="section" id="description">
<h2>26.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>While executing, cdist stores data to local cache. Currently this feature is
one way only. That means that cdist does not use stored data for future runs.
Anyway, those data can be used for debugging cdist, debugging types and
debugging after host configuration fails.</p>
<p>Local cache is saved under $HOME/.cdist/cache directory, one directory entry
for each host. Subdirectory path is specified by
<strong>-C/--cache-path-pattern</strong> option, <strong>cache_path_pattern</strong>
configuration option or by using <strong>CDIST_CACHE_PATH_PATTERN</strong>
environment variable.</p>
<p>For more info on cache path pattern see <strong>CACHE PATH PATTERN FORMAT</strong>
section in cdist man page.</p>
</div>
<div class="section" id="cache-overview">
<h2>26.2. Cache overview<a class="headerlink" href="#cache-overview" title="Permalink to this headline"></a></h2>
<p>As noted above each configured host has got its subdirectory in local cache.
Entries in host's cache directory are as follows.</p>
<dl class="docutils">
<dt>bin</dt>
<dd>directory with cdist type emulators</dd>
<dt>conf</dt>
<dd>dynamically determined cdist conf directory, union of all specified
conf directories</dd>
<dt>explorer</dt>
<dd>directory containing global explorer named files containing explorer output
after running on target host</dd>
<dt>messages</dt>
<dd>file containing messages</dd>
<dt>object</dt>
<dd>directory containing subdirectory for each cdist object</dd>
<dt>object_marker</dt>
<dd>object marker for this particular cdist run</dd>
<dt>stderr</dt>
<dd>directory containing init manifest and remote stderr stream output</dd>
<dt>stdout</dt>
<dd>directory containing init manifest and remote stdout stream output</dd>
<dt>target_host</dt>
<dd>file containing target host of this cdist run, as specified when running
cdist</dd>
<dt>typeorder</dt>
<dd>file containing types in order of execution.</dd>
</dl>
<div class="section" id="object-cache-overview">
<h3>26.2.1. Object cache overview<a class="headerlink" href="#object-cache-overview" title="Permalink to this headline"></a></h3>
<p>Each object under <strong>object</strong> directory has its own structurue.</p>
<dl class="docutils">
<dt>code-local</dt>
<dd>code generated from gencode-local, present only if something is
generated</dd>
<dt>code-remote</dt>
<dd>code generated from gencode-remote, present only if something is
generated</dd>
<dt>explorer</dt>
<dd>directory containing type explorer named files containing explorer output
after running on target host</dd>
<dt>files</dt>
<dd>directory with object files created during type execution</dd>
<dt>parameter</dt>
<dd>directory containing type parameter named files containing parameter
values</dd>
<dt>source</dt>
<dd>this type's source (init manifest)</dd>
<dt>state</dt>
<dd>this type execution state ('done' when finished)</dd>
<dt>stderr</dt>
<dd>directory containing type's manifest, gencode-* and code-* stderr stream
outputs</dd>
<dt>stdin</dt>
<dd>this type stdin content</dd>
<dt>stdout</dt>
<dd>directory containing type's manifest, gencode-* and code-* stdout stream
outputs.</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-saving-output-streams.html" class="btn btn-neutral float-right" title="27. Saving output streams" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-stages.html" class="btn btn-neutral" title="25. Execution stages" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@ -0,0 +1,332 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>12. Configuration &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="13. Manifest" href="cdist-manifest.html" />
<link rel="prev" title="11. Bootstrap" href="cdist-bootstrap.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> cdist
</a>
<div class="version">
4.10.5-270-g0dc94fb5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="cdist-intro.html">1. cdist - usable configuration management</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-why.html">2. Why should I use cdist?</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-os.html">3. Supported Operating Systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-install.html">4. How to install cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-update.html">5. How to update cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">12. Configuration</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">12.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#config-file-format">12.2. Config file format</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>12. Configuration</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/cdist-configuration.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="configuration">
<h1>12. Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline"></a></h1>
<div class="section" id="description">
<h2>12.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>cdist obtains configuration data from the following sources in the following
order:</p>
<blockquote>
<div><ol class="arabic simple">
<li>command-line options</li>
<li>configuration file specified at command-line using -g command line option</li>
<li>configuration file specified in CDIST_CONFIG_FILE environment variable</li>
<li>environment variables</li>
<li>user's configuration file (first one found of ~/.cdist.cfg, $XDG_CONFIG_HOME/cdist/cdist.cfg, in specified order)</li>
<li>in-distribution configuration file (cdist/conf/cdist.cfg)</li>
<li>system-wide configuration file (/etc/cdist.cfg)</li>
</ol>
</div></blockquote>
<p>if one exists.</p>
<p>Configuration source with lower ordering number from above has a higher
precedence. Configuration option value read from source with higher
precedence will overwrite option value, if exists, read from source with
lower precedence. That means that command-line option wins them all.</p>
<p>Users can decide on the local conifguration file location. It can be either
~/.cdist.cfg or $XDG_CONFIG_HOME/cdist/cdist.cfg. Note that, if both exist,
then ~/.cdist.cfg is used.</p>
<p>For a per-project configuration, particular environment variables or better,
CDIST_CONFIG_FILE environment variable or -g CONFIG_FILE command line option,
can be used.</p>
</div>
<div class="section" id="config-file-format">
<h2>12.2. Config file format<a class="headerlink" href="#config-file-format" title="Permalink to this headline"></a></h2>
<p>cdist configuration file is in the INI file format. Currently it supports
only [GLOBAL] section.
The possible keywords and their meanings are as follows:</p>
<dl class="docutils">
<dt><strong>archiving</strong></dt>
<dd>Use specified archiving. Valid values include:
'none', 'tar', 'tgz', 'tbz2' and 'txz'.</dd>
<dt><strong>beta</strong></dt>
<dd>Enable beta functionality. It recognizes boolean values from
'yes'/'no', 'on'/'off', 'true'/'false' and '1'/'0'.</dd>
<dt><strong>cache_path_pattern</strong></dt>
<dd>Specify cache path pattern.</dd>
<dt><strong>conf_dir</strong></dt>
<dd>List of configuration directories separated with the character conventionally
used by the operating system to separate search path components (as in PATH),
such as ':' for POSIX or ';' for Windows.
If also specified at command line then values from command line are
appended to this value.</dd>
<dt><strong>init_manifest</strong></dt>
<dd>Specify default initial manifest.</dd>
<dt><strong>inventory_dir</strong></dt>
<dd>Specify inventory directory.</dd>
<dt><strong>jobs</strong></dt>
<dd>Specify number of jobs for parallel processing. If -1 then the default,
number of CPU's in the system is used. If 0 then parallel processing in
jobs is disabled. If set to positive number then specified maximum
number of processes will be used.</dd>
<dt><strong>local_shell</strong></dt>
<dd>Shell command used for local execution.</dd>
<dt><strong>out_path</strong></dt>
<dd>Directory to save cdist output in.</dd>
<dt><strong>parallel</strong></dt>
<dd>Process hosts in parallel. If -1 then the default, number of CPU's in
the system is used. If 0 then parallel processing of hosts is disabled.
If set to positive number then specified maximum number of processes
will be used.</dd>
<dt><strong>remote_copy</strong></dt>
<dd>Command to use for remote copy (should behave like scp).</dd>
<dt><strong>remote_exec</strong></dt>
<dd>Command to use for remote execution (should behave like ssh).</dd>
<dt><strong>remote_out_path</strong></dt>
<dd>Directory to save cdist output in on the target host.</dd>
<dt><strong>remote_shell</strong></dt>
<dd>Shell command at remote host used for remote execution.</dd>
<dt><strong>save_output_streams</strong></dt>
<dd>Enable/disable saving output streams (enabled by default).
It recognizes boolean values from 'yes'/'no', 'on'/'off', 'true'/'false'
and '1'/'0'.</dd>
<dt><strong>timestamp</strong></dt>
<dd>Timestamp log messages with the current local date and time
in the format: YYYYMMDDHHMMSS.us.</dd>
<dt><strong>verbosity</strong></dt>
<dd>Set verbosity level. Valid values are:
'ERROR', 'WARNING', 'INFO', 'VERBOSE', 'DEBUG', 'TRACE' and 'OFF'.</dd>
</dl>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-manifest.html" class="btn btn-neutral float-right" title="13. Manifest" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-bootstrap.html" class="btn btn-neutral" title="11. Bootstrap" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>14. Explorer &mdash; cdist 4.5.0 documentation</title>
<title>16. Explorer &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="15. Messaging" href="cdist-messaging.html"/>
<link rel="prev" title="13.133. cdist-type__zypper_service(7)" href="man7/cdist-type__zypper_service.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="17. Messaging" href="cdist-messaging.html" />
<link rel="prev" title="15.144. cdist-type__zypper_service(7)" href="man7/cdist-type__zypper_service.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,27 +91,32 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">14. Explorer</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">14.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">14.2. Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">16. Explorer</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">16.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">16.2. Examples</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -131,7 +128,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -139,9 +136,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -164,7 +162,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>14. Explorer</li>
<li>16. Explorer</li>
<li class="wy-breadcrumbs-aside">
@ -184,9 +182,9 @@
<div itemprop="articleBody">
<div class="section" id="explorer">
<h1>14. Explorer<a class="headerlink" href="#explorer" title="Permalink to this headline"></a></h1>
<h1>16. Explorer<a class="headerlink" href="#explorer" title="Permalink to this headline"></a></h1>
<div class="section" id="description">
<h2>14.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<h2>16.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>Explorers are small shell scripts, which will be executed on the target
host. The aim of each explorer is to give hints to types on how to act on the
target system. An explorer outputs the result to stdout, which is usually
@ -197,11 +195,11 @@ type explorers. Both work almost exactly the same way, with the difference
that the values of the general explorers are stored in a general location and
the type specific below the object.</p>
<p>Explorers can reuse other explorers on the target system by calling</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$__explorer/&lt;explorer_name&gt; (general and type explorer)
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$__explorer/&lt;explorer_name&gt; (general and type explorer)
</pre></div>
</div>
<p>or</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$__type_explorer/&lt;explorer name&gt; (type explorer).
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$__type_explorer/&lt;explorer name&gt; (type explorer).
</pre></div>
</div>
<p>In case of significant errors, the explorer may exit non-zero and return an
@ -210,14 +208,14 @@ error message on stderr, which will cause cdist to abort.</p>
explorer.</p>
</div>
<div class="section" id="examples">
<h2>14.2. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<h2>16.2. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<p>A very simple explorer may look like this:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">hostname</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">hostname</span>
</pre></div>
</div>
<p>Which is in practise the <strong>hostname</strong> explorer.</p>
<p>A type explorer, which could check for the status of a package may look like this:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="o">[</span> -f <span class="s2">&quot;</span><span class="nv">$__object</span><span class="s2">/parameter/name&quot;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="o">[</span> -f <span class="s2">&quot;</span><span class="nv">$__object</span><span class="s2">/parameter/name&quot;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
<span class="nv">name</span><span class="o">=</span><span class="s2">&quot;</span><span class="k">$(</span>cat <span class="s2">&quot;</span><span class="nv">$__object</span><span class="s2">/parameter/name&quot;</span><span class="k">)</span><span class="s2">&quot;</span>
<span class="k">else</span>
<span class="nv">name</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$__object_id</span><span class="s2">&quot;</span>
@ -232,18 +230,16 @@ dpkg -s <span class="s2">&quot;</span><span class="nv">$name</span><span class="
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-messaging.html" class="btn btn-neutral float-right" title="15. Messaging" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-messaging.html" class="btn btn-neutral float-right" title="17. Messaging" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="man7/cdist-type__zypper_service.html" class="btn btn-neutral" title="13.133. cdist-type__zypper_service(7)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="man7/cdist-type__zypper_service.html" class="btn btn-neutral" title="15.144. cdist-type__zypper_service(7)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -252,11 +248,11 @@ dpkg -s <span class="s2">&quot;</span><span class="nv">$name</span><span class="
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -271,35 +267,24 @@ dpkg -s <span class="s2">&quot;</span><span class="nv">$name</span><span class="
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>7. Features &mdash; cdist 4.5.0 documentation</title>
<title>7. Features &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="8. Quickstart" href="cdist-quickstart.html"/>
<link rel="prev" title="6. Support" href="cdist-support.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="8. Quickstart" href="cdist-quickstart.html" />
<link rel="prev" title="6. Support" href="cdist-support.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,23 +91,28 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -127,7 +124,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -135,9 +132,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -222,9 +220,7 @@ Batteries included: A lot of requirements can be solved using standard types</dd
</div>
<div class="articleComments">
</div>
</div>
<footer>
@ -242,11 +238,11 @@ Batteries included: A lot of requirements can be solved using standard types</dd
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -261,35 +257,24 @@ Batteries included: A lot of requirements can be solved using standard types</dd
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>24. Hacking &mdash; cdist 4.5.0 documentation</title>
<title>29. Hacking &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="25. Troubleshooting" href="cdist-troubleshooting.html"/>
<link rel="prev" title="23. Remote exec and copy commands" href="cdist-remote-exec-copy.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="30. Troubleshooting" href="cdist-troubleshooting.html" />
<link rel="prev" title="28. Remote exec and copy commands" href="cdist-remote-exec-copy.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,31 +91,36 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">24. Hacking</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#welcome">24.1. Welcome</a></li>
<li class="toctree-l2"><a class="reference internal" href="#reporting-bugs">24.2. Reporting bugs</a></li>
<li class="toctree-l2"><a class="reference internal" href="#coding-conventions-everywhere">24.3. Coding conventions (everywhere)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#how-to-submit-stuff-for-inclusion-into-upstream-cdist">24.4. How to submit stuff for inclusion into upstream cdist</a></li>
<li class="toctree-l2"><a class="reference internal" href="#how-to-submit-a-new-type">24.5. How to submit a new type</a></li>
<li class="toctree-l2"><a class="reference internal" href="#example-git-workflow">24.6. Example git workflow</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">29. Hacking</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#welcome">29.1. Welcome</a></li>
<li class="toctree-l2"><a class="reference internal" href="#reporting-bugs">29.2. Reporting bugs</a></li>
<li class="toctree-l2"><a class="reference internal" href="#coding-conventions-everywhere">29.3. Coding conventions (everywhere)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#how-to-submit-stuff-for-inclusion-into-upstream-cdist">29.4. How to submit stuff for inclusion into upstream cdist</a></li>
<li class="toctree-l2"><a class="reference internal" href="#how-to-submit-a-new-type">29.5. How to submit a new type</a></li>
<li class="toctree-l2"><a class="reference internal" href="#example-git-workflow">29.6. Example git workflow</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -135,7 +132,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -143,9 +140,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -168,7 +166,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>24. Hacking</li>
<li>29. Hacking</li>
<li class="wy-breadcrumbs-aside">
@ -188,9 +186,9 @@
<div itemprop="articleBody">
<div class="section" id="hacking">
<h1>24. Hacking<a class="headerlink" href="#hacking" title="Permalink to this headline"></a></h1>
<h1>29. Hacking<a class="headerlink" href="#hacking" title="Permalink to this headline"></a></h1>
<div class="section" id="welcome">
<h2>24.1. Welcome<a class="headerlink" href="#welcome" title="Permalink to this headline"></a></h2>
<h2>29.1. Welcome<a class="headerlink" href="#welcome" title="Permalink to this headline"></a></h2>
<p>Welcome dear hacker! I invite you to a tour of pointers to
get into the usable configuration management system, cdist.</p>
<p>The first thing to know is probably that cdist is brought to
@ -199,19 +197,19 @@ twice before merging or implementing a feature: Less features
with good usability are far better than the opposite.</p>
</div>
<div class="section" id="reporting-bugs">
<h2>24.2. Reporting bugs<a class="headerlink" href="#reporting-bugs" title="Permalink to this headline"></a></h2>
<h2>29.2. Reporting bugs<a class="headerlink" href="#reporting-bugs" title="Permalink to this headline"></a></h2>
<p>If you believe you've found a bug and verified that it is
in the latest version, drop a mail to the cdist mailing list,
subject prefixed with &quot;[BUG] &quot; or create an issue on github.</p>
</div>
<div class="section" id="coding-conventions-everywhere">
<h2>24.3. Coding conventions (everywhere)<a class="headerlink" href="#coding-conventions-everywhere" title="Permalink to this headline"></a></h2>
<h2>29.3. Coding conventions (everywhere)<a class="headerlink" href="#coding-conventions-everywhere" title="Permalink to this headline"></a></h2>
<p>If something should be improved or needs to be fixed, add the word FIXME
nearby, so grepping for FIXME gives all positions that need to be fixed.</p>
<p>Indentation is 4 spaces (welcome to the python world).</p>
</div>
<div class="section" id="how-to-submit-stuff-for-inclusion-into-upstream-cdist">
<h2>24.4. How to submit stuff for inclusion into upstream cdist<a class="headerlink" href="#how-to-submit-stuff-for-inclusion-into-upstream-cdist" title="Permalink to this headline"></a></h2>
<h2>29.4. How to submit stuff for inclusion into upstream cdist<a class="headerlink" href="#how-to-submit-stuff-for-inclusion-into-upstream-cdist" title="Permalink to this headline"></a></h2>
<p>If you did some cool changes to cdist, which you think might be of benefit to other
cdist users, you're welcome to propose inclusion into upstream.</p>
<p>There are some requirements to ensure your changes don't break other peoples
@ -245,22 +243,21 @@ for inclusion to the mailinglist <strong>cdist-configuration-management at googl
or open a pull request at <a class="reference external" href="http://github.com/ungleich/cdist">http://github.com/ungleich/cdist</a>.</p>
</div>
<div class="section" id="how-to-submit-a-new-type">
<h2>24.5. How to submit a new type<a class="headerlink" href="#how-to-submit-a-new-type" title="Permalink to this headline"></a></h2>
<h2>29.5. How to submit a new type<a class="headerlink" href="#how-to-submit-a-new-type" title="Permalink to this headline"></a></h2>
<p>For detailed information about types, see <a class="reference external" href="cdist-type.html">cdist type</a>.</p>
<p>Submitting a type works as described above, with the additional requirement
that a corresponding manpage named man.text in asciidoc format with
that a corresponding manpage named man.rst in ReSTructured text format with
the manpage-name &quot;cdist-type__NAME&quot; is included in the type directory
AND asciidoc is able to compile it (i.e. do NOT have to many &quot;=&quot; in the second
line).</p>
AND the manpage builds (<cite>make man</cite>).</p>
<p>Warning: Submitting &quot;exec&quot; or &quot;run&quot; types that simply echo their parameter in
<strong>gencode</strong> will not be accepted, because they are of no use. Every type can output
code and thus such a type introduces redundant functionality that is given by
core cdist already.</p>
</div>
<div class="section" id="example-git-workflow">
<h2>24.6. Example git workflow<a class="headerlink" href="#example-git-workflow" title="Permalink to this headline"></a></h2>
<h2>29.6. Example git workflow<a class="headerlink" href="#example-git-workflow" title="Permalink to this headline"></a></h2>
<p>The following workflow works fine for most developers</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># get latest upstream master branch</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># get latest upstream master branch</span>
git clone https://github.com/ungleich/cdist.git
<span class="c1"># update if already existing</span>
@ -304,7 +301,7 @@ git merge origin/master
</div>
<p>If at any point you want to go back to the original master branch, you can
use <strong>git stash</strong> to stash your changes away:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">sh</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">sh</span>
</pre></div>
</div>
<blockquote>
@ -317,7 +314,7 @@ git merge origin/master</p>
</div></blockquote>
<p>Similarly when you want to develop another new feature, you go back
to the master branch and create another branch based on it:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">sh</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">code</span><span class="o">-</span><span class="n">block</span><span class="p">::</span> <span class="n">sh</span>
</pre></div>
</div>
<blockquote>
@ -334,18 +331,16 @@ in parallel)</p>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-troubleshooting.html" class="btn btn-neutral float-right" title="25. Troubleshooting" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-troubleshooting.html" class="btn btn-neutral float-right" title="30. Troubleshooting" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-remote-exec-copy.html" class="btn btn-neutral" title="23. Remote exec and copy commands" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="cdist-remote-exec-copy.html" class="btn btn-neutral" title="28. Remote exec and copy commands" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -354,11 +349,11 @@ in parallel)</p>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -373,35 +368,24 @@ in parallel)</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>4. How to install cdist &mdash; cdist 4.5.0 documentation</title>
<title>4. How to install cdist &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="5. How to update cdist" href="cdist-update.html"/>
<link rel="prev" title="3. Supported Operating Systems" href="cdist-os.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="5. How to update cdist" href="cdist-update.html" />
<link rel="prev" title="3. Supported Operating Systems" href="cdist-os.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -116,23 +108,28 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -144,7 +141,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -152,9 +149,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -231,11 +229,20 @@
a version control in place for development of your own stuff
immediately.</p>
<p>To install cdist, execute the following commands:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>git clone https://github.com/ungleich/cdist.git
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/ungleich/cdist.git
<span class="nb">cd</span> cdist
<span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span><span class="nv">$PATH</span>:<span class="k">$(</span><span class="nb">pwd</span> -P<span class="k">)</span>/bin
</pre></div>
</div>
<p>To install cdist with distutils from cloned repository, first you have to
create version.py:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>make version
</pre></div>
</div>
<p>Then, as usual, you execute the following command:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>python setup.py install
</pre></div>
</div>
<div class="section" id="available-versions-in-git">
<h4>4.2.1.1. Available versions in git<a class="headerlink" href="#available-versions-in-git" title="Permalink to this headline"></a></h4>
<blockquote>
@ -246,12 +253,12 @@ immediately.</p>
</div></blockquote>
<p>Other branches may be available for features or bugfixes, but they
may vanish at any point. To select a specific branch use</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># Generic code</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Generic code</span>
git checkout -b &lt;localbranchname&gt; origin/&lt;branchname&gt;
</pre></div>
</div>
<p>So for instance if you want to use and stay with version 4.1, you can use</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>git checkout -b <span class="m">4</span>.1 origin/4.1
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>git checkout -b <span class="m">4</span>.1 origin/4.1
</pre></div>
</div>
</div>
@ -268,7 +275,7 @@ git checkout -b &lt;localbranchname&gt; origin/&lt;branchname&gt;
<div class="section" id="building-and-using-documentation-man-and-html">
<h4>4.2.1.3. Building and using documentation (man and html)<a class="headerlink" href="#building-and-using-documentation-man-and-html" title="Permalink to this headline"></a></h4>
<p>If you want to build and use the documentation, run:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>make docs
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>make docs
</pre></div>
</div>
<p>Documentation comes in two formats, man pages and full HTML
@ -276,7 +283,7 @@ documentation. Documentation is built into distribution's
docs/dist directory. man pages are in docs/dist/man and
HTML documentation in docs/dist/html.</p>
<p>If you want to use man pages, run:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="nb">export</span> <span class="nv">MANPATH</span><span class="o">=</span><span class="nv">$MANPATH</span>:<span class="k">$(</span><span class="nb">pwd</span> -P<span class="k">)</span>/docs/dist/man
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span> <span class="nv">MANPATH</span><span class="o">=</span><span class="nv">$MANPATH</span>:<span class="k">$(</span><span class="nb">pwd</span> -P<span class="k">)</span>/docs/dist/man
</pre></div>
</div>
<p>Or you can move man pages from docs/dist/man directory to some
@ -284,29 +291,31 @@ other directory and add it to MANPATH.</p>
<p>Full HTML documentation can be accessed at docs/dist/html/index.html.</p>
<p>You can also build only man pages or only html documentation, for
only man pages run:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>make man
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>make man
</pre></div>
</div>
<p>for only html documentation run:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>make html
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>make html
</pre></div>
</div>
<p>You can also build man pages for types in your ~/.cdist directory:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>make dotman
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>make dotman
</pre></div>
</div>
<p>Built man pages are now in docs/dist/man directory. If you have
some other custom .cdist directory, e.g. /opt/cdist then use:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="nv">DOT_CDIST_PATH</span><span class="o">=</span>/opt/cdist make dotman
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>make <span class="nv">DOT_CDIST_PATH</span><span class="o">=</span>/opt/cdist dotman
</pre></div>
</div>
<p>Note that <cite>dotman</cite>-target has to be built before a <cite>make docs</cite>-run, otherwise
the custom man-pages are not picked up.</p>
</div>
</div>
<div class="section" id="python-package">
<h3>4.2.2. Python package<a class="headerlink" href="#python-package" title="Permalink to this headline"></a></h3>
<p>Cdist is available as a python package at
<a class="reference external" href="http://pypi.python.org/pypi/cdist/">PyPi</a>. You can install it using</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>pip install cdist
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>pip install cdist
</pre></div>
</div>
</div>
@ -315,9 +324,7 @@ some other custom .cdist directory, e.g. /opt/cdist then use:</p>
</div>
<div class="articleComments">
</div>
</div>
<footer>
@ -335,11 +342,11 @@ some other custom .cdist directory, e.g. /opt/cdist then use:</p>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -354,35 +361,24 @@ some other custom .cdist directory, e.g. /opt/cdist then use:</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -0,0 +1,288 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>22. cdist integration / using cdist as library &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="23. Reference" href="cdist-reference.html" />
<link rel="prev" title="21. PreOS" href="cdist-preos.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> cdist
</a>
<div class="version">
4.10.5-270-g0dc94fb5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="cdist-intro.html">1. cdist - usable configuration management</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-why.html">2. Why should I use cdist?</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-os.html">3. Supported Operating Systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-install.html">4. How to install cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-update.html">5. How to update cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">22. cdist integration / using cdist as library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">22.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">22.2. Examples</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>22. cdist integration / using cdist as library</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/cdist-integration.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="cdist-integration-using-cdist-as-library">
<h1>22. cdist integration / using cdist as library<a class="headerlink" href="#cdist-integration-using-cdist-as-library" title="Permalink to this headline"></a></h1>
<div class="section" id="description">
<h2>22.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>cdist can be integrate with other applications by importing cdist and other
cdist modules and setting all by hand. There are also helper functions which
aim to ease this integration. Just import <strong>cdist.integration</strong> and use its
functions:</p>
<ul class="simple">
<li><strong>cdist.integration.configure_hosts_simple</strong> for configuration</li>
<li><strong>cdist.integration.install_hosts_simple</strong> for installation.</li>
</ul>
<p>Functions require <cite>host</cite> and <cite>manifest</cite> parameters.
<cite>host</cite> can be specified as a string representing host or as iterable
of hosts. <cite>manifest</cite> is a path to initial manifest. For other cdist
options default values will be used. <cite>verbose</cite> is a desired verbosity
level which defaults to VERBOSE_INFO. <cite>cdist_path</cite> parameter specifies
path to cdist executable, if it is <cite>None</cite> then functions will try to
find it first from local lib directory and then in PATH.</p>
<p>In case of cdist error <strong>cdist.Error</strong> exception is raised.</p>
<p><strong>WARNING</strong>: cdist integration helper functions are not yet stable!</p>
</div>
<div class="section" id="examples">
<h2>22.2. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># configure host from python interactive shell</span>
&gt;&gt;&gt; import cdist.integration
&gt;&gt;&gt; cdist.integration.configure_hosts_simple<span class="o">(</span><span class="s1">&#39;185.203.114.185&#39;</span>,
... <span class="s1">&#39;~/.cdist/manifest/init&#39;</span><span class="o">)</span>
<span class="c1"># configure host from python interactive shell, specifying verbosity level</span>
&gt;&gt;&gt; import cdist.integration
&gt;&gt;&gt; cdist.integration.configure_hosts_simple<span class="o">(</span>
... <span class="s1">&#39;185.203.114.185&#39;</span>, <span class="s1">&#39;~/.cdist/manifest/init&#39;</span>,
... <span class="nv">verbose</span><span class="o">=</span>cdist.argparse.VERBOSE_TRACE<span class="o">)</span>
<span class="c1"># configure specified dns hosts from python interactive shell</span>
&gt;&gt;&gt; import cdist.integration
&gt;&gt;&gt; <span class="nv">hosts</span> <span class="o">=</span> <span class="o">(</span><span class="s1">&#39;dns1.ungleich.ch&#39;</span>, <span class="s1">&#39;dns2.ungleich.ch&#39;</span>, <span class="s1">&#39;dns3.ungleich.ch&#39;</span>, <span class="o">)</span>
&gt;&gt;&gt; cdist.integration.configure_hosts_simple<span class="o">(</span>hosts,
... <span class="s1">&#39;~/.cdist/manifest/init&#39;</span><span class="o">)</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-reference.html" class="btn btn-neutral float-right" title="23. Reference" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-preos.html" class="btn btn-neutral" title="21. PreOS" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>1. cdist - usable configuration management &mdash; cdist 4.5.0 documentation</title>
<title>1. cdist - usable configuration management &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="2. Why should I use cdist?" href="cdist-why.html"/>
<link rel="prev" title="Welcome to cdist documentation" href="index.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="2. Why should I use cdist?" href="cdist-why.html" />
<link rel="prev" title="Welcome to cdist documentation" href="index.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,23 +91,28 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -127,7 +124,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -135,9 +132,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -196,9 +194,7 @@ cdist is an alternative to other configuration management systems like</p>
</div>
<div class="articleComments">
</div>
</div>
<footer>
@ -216,11 +212,11 @@ cdist is an alternative to other configuration management systems like</p>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -235,35 +231,24 @@ cdist is an alternative to other configuration management systems like</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>17. Inventory &mdash; cdist 4.5.0 documentation</title>
<title>19. Inventory &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="18. Trigger" href="cdist-trigger.html"/>
<link rel="prev" title="16. Parallelization" href="cdist-parallelization.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="20. Trigger" href="cdist-trigger.html" />
<link rel="prev" title="18. Parallelization" href="cdist-parallelization.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,32 +91,37 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">17. Inventory</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#introduction">17.1. Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="#description">17.2. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#cdist-inventory-interface">17.3. cdist inventory interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="#configuring-hosts-using-inventory">17.4. Configuring hosts using inventory</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">17.5. Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="#example-of-manipulating-database">17.6. Example of manipulating database</a></li>
<li class="toctree-l2"><a class="reference internal" href="#using-external-inventory">17.7. Using external inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">19. Inventory</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#introduction">19.1. Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="#description">19.2. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#cdist-inventory-interface">19.3. cdist inventory interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="#configuring-hosts-using-inventory">19.4. Configuring hosts using inventory</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">19.5. Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="#example-of-manipulating-database">19.6. Example of manipulating database</a></li>
<li class="toctree-l2"><a class="reference internal" href="#using-external-inventory">19.7. Using external inventory</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -136,7 +133,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -144,9 +141,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -169,7 +167,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>17. Inventory</li>
<li>19. Inventory</li>
<li class="wy-breadcrumbs-aside">
@ -189,16 +187,16 @@
<div itemprop="articleBody">
<div class="section" id="inventory">
<h1>17. Inventory<a class="headerlink" href="#inventory" title="Permalink to this headline"></a></h1>
<h1>19. Inventory<a class="headerlink" href="#inventory" title="Permalink to this headline"></a></h1>
<div class="section" id="introduction">
<h2>17.1. Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<h2>19.1. Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<p>cdist comes with simple built-in tag based inventory. It is a simple inventory
with list of hosts and a host has a list of tags.
Inventory functionality is still in <strong>beta</strong> so it can be used only if beta
command line flag is specified (-b, --beta) or setting CDIST_BETA env var.</p>
</div>
<div class="section" id="description">
<h2>17.2. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<h2>19.2. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>The idea is to have simple tagging inventory. There is a list of hosts and for
each host there are tags. Inventory database is a set of files under inventory
database base directory. Filename equals hostname. Each file contains tags for
@ -211,12 +209,12 @@ tags are present.</p>
using cdist inventory interface or using standard UNIX tools.</p>
</div>
<div class="section" id="cdist-inventory-interface">
<h2>17.3. cdist inventory interface<a class="headerlink" href="#cdist-inventory-interface" title="Permalink to this headline"></a></h2>
<h2>19.3. cdist inventory interface<a class="headerlink" href="#cdist-inventory-interface" title="Permalink to this headline"></a></h2>
<p>With cdist inventory interface you can list host(s) and tag(s), add host(s),
add tag(s), delete host(s) and delete tag(s).</p>
</div>
<div class="section" id="configuring-hosts-using-inventory">
<h2>17.4. Configuring hosts using inventory<a class="headerlink" href="#configuring-hosts-using-inventory" title="Permalink to this headline"></a></h2>
<h2>19.4. Configuring hosts using inventory<a class="headerlink" href="#configuring-hosts-using-inventory" title="Permalink to this headline"></a></h2>
<p>config command now has new options, <strong>-t</strong>, <strong>-a</strong> and <strong>-A</strong>.</p>
<p><strong>-A</strong> means that all hosts in tag db is selected.</p>
<p><strong>-a</strong> means that selected hosts must contain ALL specified tags.</p>
@ -224,8 +222,8 @@ add tag(s), delete host(s) and delete tag(s).</p>
selected.</p>
</div>
<div class="section" id="examples">
<h2>17.5. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># List inventory content</span>
<h2>19.5. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># List inventory content</span>
$ cdist inventory list -b
<span class="c1"># List inventory for specified host localhost</span>
@ -240,7 +238,7 @@ $ cdist inventory add-host -b web1 web2 web3
<span class="c1"># Delete hosts from file old-hosts from inventory</span>
$ cdist inventory del-host -b -f old-hosts
<span class="c1"># Add tags to specifed hosts</span>
<span class="c1"># Add tags to specified hosts</span>
$ cdist inventory add-tag -b -t europe,croatia,web,static web1 web2
<span class="c1"># Add tag to all hosts in inventory</span>
@ -264,8 +262,8 @@ $ cdist config -b -A
</div>
</div>
<div class="section" id="example-of-manipulating-database">
<h2>17.6. Example of manipulating database<a class="headerlink" href="#example-of-manipulating-database" title="Permalink to this headline"></a></h2>
<div class="highlight-sh"><div class="highlight"><pre><span></span>$ python3 scripts/cdist inventory list -b
<h2>19.6. Example of manipulating database<a class="headerlink" href="#example-of-manipulating-database" title="Permalink to this headline"></a></h2>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ python3 scripts/cdist inventory list -b
$ python3 scripts/cdist inventory add-host -b localhost
$ python3 scripts/cdist inventory add-host -b test.mycloud.net
$ python3 scripts/cdist inventory list -b
@ -373,14 +371,14 @@ cloud
<p>For more info about inventory commands and options see <a class="reference external" href="man1/cdist.html">cdist</a>(1).</p>
</div>
<div class="section" id="using-external-inventory">
<h2>17.7. Using external inventory<a class="headerlink" href="#using-external-inventory" title="Permalink to this headline"></a></h2>
<h2>19.7. Using external inventory<a class="headerlink" href="#using-external-inventory" title="Permalink to this headline"></a></h2>
<p>cdist can be used with any external inventory where external inventory is
some storage or database from which you can get a list of hosts to configure.
cdist can then be fed with this list of hosts through stdin or file using
<strong>-f</strong> option. For example, if your host list is stored in sqlite3 database
hosts.db and you want to select hosts which purpose is <strong>django</strong> then you
can use it with cdist like:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>$ sqlite3 hosts.db <span class="s2">&quot;select hostname from hosts where purpose = &#39;django&#39;;&quot;</span> <span class="p">|</span> cdist config
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sqlite3 hosts.db <span class="s2">&quot;select hostname from hosts where purpose = &#39;django&#39;;&quot;</span> <span class="p">|</span> cdist config
</pre></div>
</div>
</div>
@ -388,18 +386,16 @@ can use it with cdist like:</p>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-trigger.html" class="btn btn-neutral float-right" title="18. Trigger" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-trigger.html" class="btn btn-neutral float-right" title="20. Trigger" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-parallelization.html" class="btn btn-neutral" title="16. Parallelization" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="cdist-parallelization.html" class="btn btn-neutral" title="18. Parallelization" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -408,11 +404,11 @@ can use it with cdist like:</p>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -427,35 +423,24 @@ can use it with cdist like:</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>11. Manifest &mdash; cdist 4.5.0 documentation</title>
<title>13. Manifest &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="12. cdist type" href="cdist-type.html"/>
<link rel="prev" title="10. Bootstrap" href="cdist-bootstrap.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="14. cdist type" href="cdist-type.html" />
<link rel="prev" title="12. Configuration" href="cdist-configuration.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,33 +91,38 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">11. Manifest</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">11.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#initial-and-type-manifests">11.2. Initial and type manifests</a></li>
<li class="toctree-l2"><a class="reference internal" href="#define-state-in-the-initial-manifest">11.3. Define state in the initial manifest</a></li>
<li class="toctree-l2"><a class="reference internal" href="#splitting-up-the-initial-manifest">11.4. Splitting up the initial manifest</a></li>
<li class="toctree-l2"><a class="reference internal" href="#dependencies">11.5. Dependencies</a></li>
<li class="toctree-l2"><a class="reference internal" href="#create-dependencies-from-execution-order">11.6. Create dependencies from execution order</a></li>
<li class="toctree-l2"><a class="reference internal" href="#overrides">11.7. Overrides</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">11.8. Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">13. Manifest</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">13.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#initial-and-type-manifests">13.2. Initial and type manifests</a></li>
<li class="toctree-l2"><a class="reference internal" href="#define-state-in-the-initial-manifest">13.3. Define state in the initial manifest</a></li>
<li class="toctree-l2"><a class="reference internal" href="#splitting-up-the-initial-manifest">13.4. Splitting up the initial manifest</a></li>
<li class="toctree-l2"><a class="reference internal" href="#dependencies">13.5. Dependencies</a></li>
<li class="toctree-l2"><a class="reference internal" href="#create-dependencies-from-execution-order">13.6. Create dependencies from execution order</a></li>
<li class="toctree-l2"><a class="reference internal" href="#overrides">13.7. Overrides</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">13.8. Examples</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -137,7 +134,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -145,9 +142,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -170,7 +168,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>11. Manifest</li>
<li>13. Manifest</li>
<li class="wy-breadcrumbs-aside">
@ -190,9 +188,9 @@
<div itemprop="articleBody">
<div class="section" id="manifest">
<h1>11. Manifest<a class="headerlink" href="#manifest" title="Permalink to this headline"></a></h1>
<h1>13. Manifest<a class="headerlink" href="#manifest" title="Permalink to this headline"></a></h1>
<div class="section" id="description">
<h2>11.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<h2>13.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>Manifests are used to define which objects to create.
Objects are instances of <strong>types</strong>, like in object oriented programming languages.
An object is represented by the combination of
@ -204,7 +202,7 @@ setup the MANPATH correctly, you can use <strong>man cdist-reference</strong> to
the reference with pointers to the manpages.</p>
<p>Types in manifests are used like normal command line tools. Let's have a look
at an example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Create object of type __package with the parameter state = absent</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Create object of type __package with the parameter state = absent</span>
<span class="n">__package</span> <span class="n">apache2</span> <span class="o">--</span><span class="n">state</span> <span class="n">absent</span>
<span class="c1"># Same with the __directory type</span>
@ -221,14 +219,14 @@ the parameters are exactly the same.</p>
on given conditions.</p>
</div>
<div class="section" id="initial-and-type-manifests">
<h2>11.2. Initial and type manifests<a class="headerlink" href="#initial-and-type-manifests" title="Permalink to this headline"></a></h2>
<h2>13.2. Initial and type manifests<a class="headerlink" href="#initial-and-type-manifests" title="Permalink to this headline"></a></h2>
<p>Cdist knows about two types of manifests: The initial manifest and type
manifests. The initial manifest is used to define, which configurations
to apply to which hosts. The type manifests are used to create objects
from types. More about manifests in types can be found in <a class="reference external" href="cdist-type.html">cdist type</a>.</p>
</div>
<div class="section" id="define-state-in-the-initial-manifest">
<h2>11.3. Define state in the initial manifest<a class="headerlink" href="#define-state-in-the-initial-manifest" title="Permalink to this headline"></a></h2>
<h2>13.3. Define state in the initial manifest<a class="headerlink" href="#define-state-in-the-initial-manifest" title="Permalink to this headline"></a></h2>
<p>The <strong>initial manifest</strong> is the entry point for cdist to find out, which
<strong>objects</strong> to configure on the selected host.
Cdist expects the initial manifest at <strong>cdist/conf/manifest/init</strong>.</p>
@ -236,7 +234,7 @@ Cdist expects the initial manifest at <strong>cdist/conf/manifest/init</strong>.
created on which host. To distinguish between hosts, you can use the
environment variable <strong>__target_host</strong> and/or <strong>__target_hostname</strong> and/or
<strong>__target_fqdn</strong>. Let's have a look at a simple example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">__cdistmarker</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">__cdistmarker</span>
<span class="n">case</span> <span class="s2">&quot;$__target_host&quot;</span> <span class="ow">in</span>
<span class="n">localhost</span><span class="p">)</span>
@ -255,13 +253,13 @@ utilises cdist types. Every available type can be executed like a normal
command.</p>
</div>
<div class="section" id="splitting-up-the-initial-manifest">
<h2>11.4. Splitting up the initial manifest<a class="headerlink" href="#splitting-up-the-initial-manifest" title="Permalink to this headline"></a></h2>
<h2>13.4. Splitting up the initial manifest<a class="headerlink" href="#splitting-up-the-initial-manifest" title="Permalink to this headline"></a></h2>
<p>If you want to split up your initial manifest, you can create other shell
scripts in <strong>cdist/conf/manifest/</strong> and include them in <strong>cdist/conf/manifest/init</strong>.
Cdist provides the environment variable <strong>__manifest</strong> to reference
the directory containing the initial manifest (see <a class="reference external" href="cdist-reference.html">cdist reference</a>).</p>
<p>The following example would include every file with a <strong>.sh</strong> suffix:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span># Include *.sh
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># Include *.sh
for manifest in $__manifest/*.sh; do
# And source scripts into our shell environment
. &quot;$manifest&quot;
@ -270,11 +268,11 @@ done
</div>
</div>
<div class="section" id="dependencies">
<h2>11.5. Dependencies<a class="headerlink" href="#dependencies" title="Permalink to this headline"></a></h2>
<h2>13.5. Dependencies<a class="headerlink" href="#dependencies" title="Permalink to this headline"></a></h2>
<p>If you want to describe that something requires something else, just
setup the variable &quot;require&quot; to contain the requirements. Multiple
requirements can be added white space separated.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span> <span class="mi">1</span> <span class="c1"># No dependency</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="mi">1</span> <span class="c1"># No dependency</span>
<span class="mi">2</span> <span class="n">__file</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">cdist</span><span class="o">-</span><span class="n">configured</span>
<span class="mi">3</span>
<span class="mi">4</span> <span class="c1"># Require above object</span>
@ -299,7 +297,7 @@ if necessary before &quot;__link&quot; proceeds (or to abort execution with an e
export the &quot;require&quot; variable as well. But then, if you need to add extra
dependencies to a specific type, you have to make sure that you append these
to the globally already defined one.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># First of all, update the package index</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># First of all, update the package index</span>
<span class="n">__package_update_index</span>
<span class="c1"># Upgrade all the installed packages afterwards</span>
<span class="n">require</span><span class="o">=</span><span class="s2">&quot;__package_update_index&quot;</span> <span class="n">__package_upgrade_all</span>
@ -321,7 +319,7 @@ cdist jargon.</p>
in <a class="reference external" href="cdist-stages.html">cdist execution stages</a> and of how types work in <a class="reference external" href="cdist-type.html">cdist type</a>.</p>
</div>
<div class="section" id="create-dependencies-from-execution-order">
<h2>11.6. Create dependencies from execution order<a class="headerlink" href="#create-dependencies-from-execution-order" title="Permalink to this headline"></a></h2>
<h2>13.6. Create dependencies from execution order<a class="headerlink" href="#create-dependencies-from-execution-order" title="Permalink to this headline"></a></h2>
<p>You can tell cdist to execute all types in the order in which they are created
in the manifest by setting up the variable CDIST_ORDER_DEPENDENCY.
When cdist sees that this variable is setup, the current created object
@ -330,7 +328,7 @@ automatically depends on the previously created object.</p>
(like first creating the directory xyz than the file below the directory).</p>
</div>
<div class="section" id="overrides">
<h2>11.7. Overrides<a class="headerlink" href="#overrides" title="Permalink to this headline"></a></h2>
<h2>13.7. Overrides<a class="headerlink" href="#overrides" title="Permalink to this headline"></a></h2>
<p>In some special cases, you would like to create an already defined object
with different parameters. In normal situations this leads to an error in cdist.
If you wish, you can setup the environment variable CDIST_OVERRIDE
@ -344,9 +342,9 @@ CDIST_ORDER_DEPENDENCY will be ignored, because adding a dependency in case of
overrides would result in circular dependencies, which is an error.</p>
</div>
<div class="section" id="examples">
<h2>11.8. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<h2>13.8. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<p>The initial manifest may for instance contain the following code:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># Always create this file, so other sysadmins know cdist is used.</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Always create this file, so other sysadmins know cdist is used.</span>
__file /etc/cdist-configured
<span class="k">case</span> <span class="s2">&quot;</span><span class="nv">$__target_host</span><span class="s2">&quot;</span> in
@ -358,11 +356,11 @@ __file /etc/cdist-configured
</pre></div>
</div>
<p>The manifest of the type &quot;nologin&quot; may look like this:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>__file /etc/nologin --source <span class="s2">&quot;</span><span class="nv">$__type</span><span class="s2">/files/default.nologin&quot;</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>__file /etc/nologin --source <span class="s2">&quot;</span><span class="nv">$__type</span><span class="s2">/files/default.nologin&quot;</span>
</pre></div>
</div>
<p>This example makes use of dependencies:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># Ensure that lighttpd is installed</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Ensure that lighttpd is installed</span>
__package lighttpd --state present
<span class="c1"># Ensure that munin makes use of lighttpd instead of the default webserver</span>
<span class="c1"># package as decided by the package manager</span>
@ -370,7 +368,7 @@ __package lighttpd --state present
</pre></div>
</div>
<p>How to override objects:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># for example in the initial manifest</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># for example in the initial manifest</span>
<span class="c1"># create user account foobar with some hash for password</span>
__user foobar --password <span class="s1">&#39;some_fancy_hash&#39;</span> --home /home/foobarexample
@ -389,7 +387,7 @@ __user foobar --password <span class="s1">&#39;some_other_hash&#39;</span>
</pre></div>
</div>
<p>Dependencies defined by execution order work as following:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># Tells cdist to execute all types in the order in which they are created ...</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Tells cdist to execute all types in the order in which they are created ...</span>
<span class="nb">export</span> <span class="nv">CDIST_ORDER_DEPENDENCY</span><span class="o">=</span>on
__sample_type <span class="m">1</span>
<span class="nv">require</span><span class="o">=</span><span class="s2">&quot;__some_type_somewhere/id&quot;</span> __sample_type <span class="m">2</span>
@ -412,18 +410,16 @@ __not_in_order_type <span class="m">42</span>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-type.html" class="btn btn-neutral float-right" title="12. cdist type" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-type.html" class="btn btn-neutral float-right" title="14. cdist type" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-bootstrap.html" class="btn btn-neutral" title="10. Bootstrap" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="cdist-configuration.html" class="btn btn-neutral" title="12. Configuration" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -432,11 +428,11 @@ __not_in_order_type <span class="m">42</span>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -451,35 +447,24 @@ __not_in_order_type <span class="m">42</span>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>15. Messaging &mdash; cdist 4.5.0 documentation</title>
<title>17. Messaging &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="16. Parallelization" href="cdist-parallelization.html"/>
<link rel="prev" title="14. Explorer" href="cdist-explorer.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="18. Parallelization" href="cdist-parallelization.html" />
<link rel="prev" title="16. Explorer" href="cdist-explorer.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,28 +91,33 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">15. Messaging</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">15.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#availability">15.2. Availability</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">15.3. Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">17. Messaging</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">17.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#availability">17.2. Availability</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">17.3. Examples</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -132,7 +129,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -140,9 +137,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -165,7 +163,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>15. Messaging</li>
<li>17. Messaging</li>
<li class="wy-breadcrumbs-aside">
@ -185,9 +183,9 @@
<div itemprop="articleBody">
<div class="section" id="messaging">
<h1>15. Messaging<a class="headerlink" href="#messaging" title="Permalink to this headline"></a></h1>
<h1>17. Messaging<a class="headerlink" href="#messaging" title="Permalink to this headline"></a></h1>
<div class="section" id="description">
<h2>15.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<h2>17.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>cdist has a simple but powerful way of allowing communication between
the initial manifest and types as well as types and types.</p>
<p>Whenever execution is passed from cdist to one of the
@ -205,7 +203,7 @@ between the different objects (see <a class="reference external" href="cdist-man
can only react reliably on messages by objects that you depend on.</p>
</div>
<div class="section" id="availability">
<h2>15.2. Availability<a class="headerlink" href="#availability" title="Permalink to this headline"></a></h2>
<h2>17.2. Availability<a class="headerlink" href="#availability" title="Permalink to this headline"></a></h2>
<p>Messaging is possible between all <strong>local</strong> scripts:</p>
<ul class="simple">
<li>initial manifest</li>
@ -215,19 +213,19 @@ can only react reliably on messages by objects that you depend on.</p>
</ul>
</div>
<div class="section" id="examples">
<h2>15.3. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<h2>17.3. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<p>When you want to emit a message use:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="nb">echo</span> <span class="s2">&quot;something&quot;</span> &gt;&gt; <span class="s2">&quot;</span><span class="nv">$__messages_out</span><span class="s2">&quot;</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">echo</span> <span class="s2">&quot;something&quot;</span> &gt;&gt; <span class="s2">&quot;</span><span class="nv">$__messages_out</span><span class="s2">&quot;</span>
</pre></div>
</div>
<p>When you want to react on a message use:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="k">if</span> grep -q <span class="s2">&quot;^__your_type/object/id:something&quot;</span> <span class="s2">&quot;</span><span class="nv">$__messages_in</span><span class="s2">&quot;</span><span class="p">;</span> <span class="k">then</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> grep -q <span class="s2">&quot;^__your_type/object/id:something&quot;</span> <span class="s2">&quot;</span><span class="nv">$__messages_in</span><span class="s2">&quot;</span><span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> <span class="s2">&quot;I do something else&quot;</span>
<span class="k">fi</span>
</pre></div>
</div>
<p>Some real life examples:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># Reacting on changes from block for keepalive</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Reacting on changes from block for keepalive</span>
<span class="k">if</span> grep -q <span class="s2">&quot;^__block/keepalive-vrrp&quot;</span> <span class="s2">&quot;</span><span class="nv">$__messages_in</span><span class="s2">&quot;</span><span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> /etc/init.d/keepalived restart
<span class="k">fi</span>
@ -239,7 +237,7 @@ can only react reliably on messages by objects that you depend on.</p>
</pre></div>
</div>
<p>Restart sshd on changes</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="nv">os</span><span class="o">=</span><span class="s2">&quot;</span><span class="k">$(</span>cat <span class="s2">&quot;</span><span class="nv">$__global</span><span class="s2">/explorer/os&quot;</span><span class="k">)</span><span class="s2">&quot;</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nv">os</span><span class="o">=</span><span class="s2">&quot;</span><span class="k">$(</span>cat <span class="s2">&quot;</span><span class="nv">$__global</span><span class="s2">/explorer/os&quot;</span><span class="k">)</span><span class="s2">&quot;</span>
<span class="k">case</span> <span class="s2">&quot;</span><span class="nv">$os</span><span class="s2">&quot;</span> in
centos<span class="p">|</span>redhat<span class="p">|</span>suse<span class="o">)</span>
@ -269,18 +267,16 @@ can only react reliably on messages by objects that you depend on.</p>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-parallelization.html" class="btn btn-neutral float-right" title="16. Parallelization" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-parallelization.html" class="btn btn-neutral float-right" title="18. Parallelization" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-explorer.html" class="btn btn-neutral" title="14. Explorer" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="cdist-explorer.html" class="btn btn-neutral" title="16. Explorer" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -289,11 +285,11 @@ can only react reliably on messages by objects that you depend on.</p>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -308,35 +304,24 @@ can only react reliably on messages by objects that you depend on.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3. Supported Operating Systems &mdash; cdist 4.5.0 documentation</title>
<title>3. Supported Operating Systems &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="4. How to install cdist" href="cdist-install.html"/>
<link rel="prev" title="2. Why should I use cdist?" href="cdist-why.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="4. How to install cdist" href="cdist-install.html" />
<link rel="prev" title="2. Why should I use cdist?" href="cdist-why.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,23 +91,28 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -127,7 +124,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -135,9 +132,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -199,9 +197,7 @@
</div>
<div class="articleComments">
</div>
</div>
<footer>
@ -219,11 +215,11 @@
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -238,35 +234,24 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>16. Parallelization &mdash; cdist 4.5.0 documentation</title>
<title>18. Parallelization &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="17. Inventory" href="cdist-inventory.html"/>
<link rel="prev" title="15. Messaging" href="cdist-messaging.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="19. Inventory" href="cdist-inventory.html" />
<link rel="prev" title="17. Messaging" href="cdist-messaging.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,28 +91,33 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">16. Parallelization</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">16.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">16.2. Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="#caveats">16.3. Caveats</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">18. Parallelization</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">18.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">18.2. Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="#caveats">18.3. Caveats</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -132,7 +129,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -140,9 +137,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -165,7 +163,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>16. Parallelization</li>
<li>18. Parallelization</li>
<li class="wy-breadcrumbs-aside">
@ -185,9 +183,9 @@
<div itemprop="articleBody">
<div class="section" id="parallelization">
<h1>16. Parallelization<a class="headerlink" href="#parallelization" title="Permalink to this headline"></a></h1>
<h1>18. Parallelization<a class="headerlink" href="#parallelization" title="Permalink to this headline"></a></h1>
<div class="section" id="description">
<h2>16.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<h2>18.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>cdist has two modes of parallel operation.</p>
<p>One of them is to operate on each host in separate process. This is enabled
with <strong>-p/--parallel</strong> option.</p>
@ -203,8 +201,8 @@ using specified number of parallel jobs.</p>
<p>For more info on those options see <strong>cdist</strong>(1).</p>
</div>
<div class="section" id="examples">
<h2>16.2. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-sh"><div class="highlight"><pre><span></span><span class="c1"># Configure hosts read from file hosts.file in parallel</span>
<h2>18.2. Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Configure hosts read from file hosts.file in parallel</span>
$ cdist config -p -f hosts.file
<span class="c1"># Configure hosts read from file hosts.file sequentially but using default</span>
@ -218,7 +216,7 @@ $ cdist config -b -j <span class="m">16</span> -p -f hosts.file
</div>
</div>
<div class="section" id="caveats">
<h2>16.3. Caveats<a class="headerlink" href="#caveats" title="Permalink to this headline"></a></h2>
<h2>18.3. Caveats<a class="headerlink" href="#caveats" title="Permalink to this headline"></a></h2>
<p>When operating in parallel, either by operating in parallel for each host
(-p/--parallel) or by parallel jobs within a host (-j/--jobs), and depending
on target SSH server and its configuration you may encounter connection drops.
@ -230,7 +228,7 @@ This limit is controlled with sshd :strong:MaxSessions configuration
options. For more details refer to <strong>sshd_config</strong>(5).</p>
<p>For example, if you reach <strong>MaxSessions</strong> sessions you may get the
following output:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>$ cdist config -b -j <span class="m">11</span> -v <span class="m">78</span>.47.116.244
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ cdist config -b -j <span class="m">11</span> -v <span class="m">78</span>.47.116.244
INFO: cdist: version <span class="m">4</span>.2.2-55-g640b7f9
INFO: <span class="m">78</span>.47.116.244: Running global explorers
INFO: <span class="m">78</span>.47.116.244: Remote transfer in <span class="m">11</span> parallel <span class="nb">jobs</span>
@ -253,18 +251,16 @@ INFO: cdist: Total processing <span class="nb">time</span> <span class="k">for</
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-inventory.html" class="btn btn-neutral float-right" title="17. Inventory" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-inventory.html" class="btn btn-neutral float-right" title="19. Inventory" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-messaging.html" class="btn btn-neutral" title="15. Messaging" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="cdist-messaging.html" class="btn btn-neutral" title="17. Messaging" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -273,11 +269,11 @@ INFO: cdist: Total processing <span class="nb">time</span> <span class="k">for</
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -292,35 +288,24 @@ INFO: cdist: Total processing <span class="nb">time</span> <span class="k">for</
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>19. PreOS &mdash; cdist 4.5.0 documentation</title>
<title>21. PreOS &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="20. Reference" href="cdist-reference.html"/>
<link rel="prev" title="18. Trigger" href="cdist-trigger.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="22. cdist integration / using cdist as library" href="cdist-integration.html" />
<link rel="prev" title="20. Trigger" href="cdist-trigger.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,36 +91,41 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">19. PreOS</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">19.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#preos-creation">19.2. PreOS creation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#implementing-new-preos-sub-command">19.3. Implementing new PreOS sub-command</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#example-writing-new-dummy-preos-sub-command">19.3.1. Example writing new dummy preos sub-command</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#module-based-preos">19.3.1.1. Module based preos:</a></li>
<li class="toctree-l4"><a class="reference internal" href="#class-based-preos">19.3.1.2. Class based preos:</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">21. PreOS</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">21.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#preos-creation">21.2. PreOS creation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#implementing-new-preos-sub-command">21.3. Implementing new PreOS sub-command</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#example-writing-new-dummy-preos-sub-command">21.3.1. Example writing new dummy preos sub-command</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#module-based-preos">21.3.1.1. Module based preos:</a></li>
<li class="toctree-l4"><a class="reference internal" href="#class-based-preos">21.3.1.2. Class based preos:</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#simple-tipical-use-case-for-using-preos-and-trigger">19.4. Simple tipical use case for using PreOS and trigger</a></li>
<li class="toctree-l2"><a class="reference internal" href="#simple-tipical-use-case-for-using-preos-and-trigger">21.4. Simple tipical use case for using PreOS and trigger</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -140,7 +137,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -148,9 +145,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -173,7 +171,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>19. PreOS</li>
<li>21. PreOS</li>
<li class="wy-breadcrumbs-aside">
@ -193,16 +191,16 @@
<div itemprop="articleBody">
<div class="section" id="preos">
<h1>19. PreOS<a class="headerlink" href="#preos" title="Permalink to this headline"></a></h1>
<h1>21. PreOS<a class="headerlink" href="#preos" title="Permalink to this headline"></a></h1>
<div class="section" id="description">
<h2>19.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<h2>21.1. Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>With cdist you can install and configure new machines. You can use cdist to
create PreOS, minimal OS which purpose is to boot new machine.
After PreOS is booted machine is ready for installing desired OS and
then it is ready for configuration.</p>
</div>
<div class="section" id="preos-creation">
<h2>19.2. PreOS creation<a class="headerlink" href="#preos-creation" title="Permalink to this headline"></a></h2>
<h2>21.2. PreOS creation<a class="headerlink" href="#preos-creation" title="Permalink to this headline"></a></h2>
<p>With cdist you can create PreOS.
Currently supported PreOS-es include:</p>
<ul class="simple">
@ -213,17 +211,17 @@ Currently supported PreOS-es include:</p>
<p>PreOS is created using cdist preos command. preos command has subcommands that
create the desired PreOS.</p>
<p>For example, to create ubuntu PreOS:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>$ cdist preos ubuntu /preos/preos-ubuntu -b -C <span class="se">\</span>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ cdist preos ubuntu /preos/preos-ubuntu -b -C <span class="se">\</span>
-k ~/.ssh/id_rsa.pub -p /preos/pxe-ubuntu <span class="se">\</span>
-t <span class="s2">&quot;/usr/bin/curl 192.168.111.5:3000/install/&quot;</span>
</pre></div>
</div>
<p>For more info about available options see cdist manual page.</p>
<p>This will bootstrap (<code class="docutils literal"><span class="pre">-b</span></code>) ubuntu PreOS in <code class="docutils literal"><span class="pre">/preos/preos-ubuntu</span></code> directory, it
will be configured (<code class="docutils literal"><span class="pre">-C</span></code>) using default built-in initial manifest and with
specified ssh authorized key (<code class="docutils literal"><span class="pre">-k</span></code>) and with specified trigger command (<code class="docutils literal"><span class="pre">-t</span></code>).
<p>This will bootstrap (<code class="docutils literal notranslate"><span class="pre">-b</span></code>) ubuntu PreOS in <code class="docutils literal notranslate"><span class="pre">/preos/preos-ubuntu</span></code> directory, it
will be configured (<code class="docutils literal notranslate"><span class="pre">-C</span></code>) using default built-in initial manifest and with
specified ssh authorized key (<code class="docutils literal notranslate"><span class="pre">-k</span></code>) and with specified trigger command (<code class="docutils literal notranslate"><span class="pre">-t</span></code>).
After bootstrapping and configuration PXE
boot directory will be created (<code class="docutils literal"><span class="pre">-p</span></code>) in <code class="docutils literal"><span class="pre">/preos/pxe-ubuntu</span></code>.</p>
boot directory will be created (<code class="docutils literal notranslate"><span class="pre">-p</span></code>) in <code class="docutils literal notranslate"><span class="pre">/preos/pxe-ubuntu</span></code>.</p>
<p>After PreOS is created new machines can be booted using created PXE (after
proper dhcp, tftp setting).</p>
<p>Since PreOS is configured with ssh authorized key it can be accessed throguh
@ -237,37 +235,37 @@ for installation then cdist trigger server will start install command for the
client host using parameters specified at trigger server startup.</p>
</div>
<div class="section" id="implementing-new-preos-sub-command">
<h2>19.3. Implementing new PreOS sub-command<a class="headerlink" href="#implementing-new-preos-sub-command" title="Permalink to this headline"></a></h2>
<h2>21.3. Implementing new PreOS sub-command<a class="headerlink" href="#implementing-new-preos-sub-command" title="Permalink to this headline"></a></h2>
<p>preos command is implemented as a plugin system. This plugin system scans for
preos subcommands in <code class="docutils literal"><span class="pre">cdist/preos/</span></code> distribution directory and also in
<code class="docutils literal"><span class="pre">~/.cdist/preos/</span></code> directory if it exists.</p>
preos subcommands in <code class="docutils literal notranslate"><span class="pre">cdist/preos/</span></code> distribution directory and also in
<code class="docutils literal notranslate"><span class="pre">~/.cdist/preos/</span></code> directory if it exists.</p>
<p>preos subcommand is a module or a class that satisfies the following:</p>
<ul class="simple">
<li>it has attribute <code class="docutils literal"><span class="pre">_cdist_preos</span></code> set to <code class="docutils literal"><span class="pre">True</span></code></li>
<li>it has function/method <code class="docutils literal"><span class="pre">commandline</span></code>.</li>
<li>it has attribute <code class="docutils literal notranslate"><span class="pre">_cdist_preos</span></code> set to <code class="docutils literal notranslate"><span class="pre">True</span></code></li>
<li>it has function/method <code class="docutils literal notranslate"><span class="pre">commandline</span></code>.</li>
</ul>
<p>For a module based preos subcommand <code class="docutils literal"><span class="pre">commandline</span></code> function accepts a module
<p>For a module based preos subcommand <code class="docutils literal notranslate"><span class="pre">commandline</span></code> function accepts a module
object as its first argument and the list of command line
arguments (<code class="docutils literal"><span class="pre">sys.argv[2:]</span></code>).</p>
<p>For a class preos subcommand <code class="docutils literal"><span class="pre">commandline</span></code> method should be staticmethod and
arguments (<code class="docutils literal notranslate"><span class="pre">sys.argv[2:]</span></code>).</p>
<p>For a class preos subcommand <code class="docutils literal notranslate"><span class="pre">commandline</span></code> method should be staticmethod and
it accepts a class object as its first argument and the list of command line
arguments(<code class="docutils literal"><span class="pre">sys.argv[2:]</span></code>).</p>
<p>If preos scanning finds a module/class that has <code class="docutils literal"><span class="pre">_cdist_preos</span></code> set
to <code class="docutils literal"><span class="pre">True</span></code> and it has function/method <code class="docutils literal"><span class="pre">commandline</span></code> then this module/class is
registered to preos subcommands. The name of the command is set to <code class="docutils literal"><span class="pre">_preos_name</span></code>
arguments(<code class="docutils literal notranslate"><span class="pre">sys.argv[2:]</span></code>).</p>
<p>If preos scanning finds a module/class that has <code class="docutils literal notranslate"><span class="pre">_cdist_preos</span></code> set
to <code class="docutils literal notranslate"><span class="pre">True</span></code> and it has function/method <code class="docutils literal notranslate"><span class="pre">commandline</span></code> then this module/class is
registered to preos subcommands. The name of the command is set to <code class="docutils literal notranslate"><span class="pre">_preos_name</span></code>
attribute if it exists, otherwise it is set to the module/class name, lowercase.
When registered preos subcommand is specified as preos command then <code class="docutils literal"><span class="pre">commandline</span></code>
When registered preos subcommand is specified as preos command then <code class="docutils literal notranslate"><span class="pre">commandline</span></code>
will be called with first argument set to module/class object and second argument
set to <code class="docutils literal"><span class="pre">sys.argv[2:]</span></code>.</p>
set to <code class="docutils literal notranslate"><span class="pre">sys.argv[2:]</span></code>.</p>
<div class="section" id="example-writing-new-dummy-preos-sub-command">
<h3>19.3.1. Example writing new dummy preos sub-command<a class="headerlink" href="#example-writing-new-dummy-preos-sub-command" title="Permalink to this headline"></a></h3>
<h3>21.3.1. Example writing new dummy preos sub-command<a class="headerlink" href="#example-writing-new-dummy-preos-sub-command" title="Permalink to this headline"></a></h3>
<div class="section" id="module-based-preos">
<h4>19.3.1.1. Module based preos:<a class="headerlink" href="#module-based-preos" title="Permalink to this headline"></a></h4>
<h4>21.3.1.1. Module based preos:<a class="headerlink" href="#module-based-preos" title="Permalink to this headline"></a></h4>
<ol class="arabic simple">
<li>Create directory <code class="docutils literal"><span class="pre">~/.cdist/preos/</span></code> if it does not exist</li>
<li>Create <code class="docutils literal"><span class="pre">~/.cdist/preos/netbsd.py</span></code> with the following contents:</li>
<li>Create directory <code class="docutils literal notranslate"><span class="pre">~/.cdist/preos/</span></code> if it does not exist</li>
<li>Create <code class="docutils literal notranslate"><span class="pre">~/.cdist/preos/netbsd.py</span></code> with the following contents:</li>
</ol>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">_preos_name</span> <span class="o">=</span> <span class="s1">&#39;netbsd&#39;</span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">_preos_name</span> <span class="o">=</span> <span class="s1">&#39;netbsd&#39;</span>
<span class="n">_cdist_preos</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">def</span> <span class="nf">commandline</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">args</span><span class="p">):</span>
@ -275,7 +273,7 @@ set to <code class="docutils literal"><span class="pre">sys.argv[2:]</span></cod
</pre></div>
</div>
<p>When you try to run this new preos you will get:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>$ cdist preos -h
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ cdist preos -h
usage: cdist preos <span class="o">[</span>-h<span class="o">]</span> preos
Create PreOS
@ -291,12 +289,12 @@ NetBSD PreOS: <span class="o">[]</span>
</div>
</div>
<div class="section" id="class-based-preos">
<h4>19.3.1.2. Class based preos:<a class="headerlink" href="#class-based-preos" title="Permalink to this headline"></a></h4>
<h4>21.3.1.2. Class based preos:<a class="headerlink" href="#class-based-preos" title="Permalink to this headline"></a></h4>
<ol class="arabic simple">
<li>Create directory <code class="docutils literal"><span class="pre">~/.cdist/preos/</span></code> if it does not exist</li>
<li>Create <code class="docutils literal"><span class="pre">~/.cdist/preos/freebsd.py</span></code> with the following contents:</li>
<li>Create directory <code class="docutils literal notranslate"><span class="pre">~/.cdist/preos/</span></code> if it does not exist</li>
<li>Create <code class="docutils literal notranslate"><span class="pre">~/.cdist/preos/freebsd.py</span></code> with the following contents:</li>
</ol>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">FreeBSD</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">FreeBSD</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="n">_cdist_preos</span> <span class="o">=</span> <span class="bp">True</span>
<span class="nd">@classmethod</span>
@ -305,7 +303,7 @@ NetBSD PreOS: <span class="o">[]</span>
</pre></div>
</div>
<p>When you try to run this new preos you will get:</p>
<div class="highlight-sh"><div class="highlight"><pre><span></span>$ cdist preos -h
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ cdist preos -h
usage: cdist preos <span class="o">[</span>-h<span class="o">]</span> preos
Create PreOS
@ -319,18 +317,18 @@ $ cdist preos freebsd
FreeBSD dummy preos: <span class="o">[]</span>
</pre></div>
</div>
<p>In the <code class="docutils literal"><span class="pre">commandline</span></code> function/method you have all the freedom to actually create
<p>In the <code class="docutils literal notranslate"><span class="pre">commandline</span></code> function/method you have all the freedom to actually create
PreOS.</p>
</div>
</div>
</div>
<div class="section" id="simple-tipical-use-case-for-using-preos-and-trigger">
<h2>19.4. Simple tipical use case for using PreOS and trigger<a class="headerlink" href="#simple-tipical-use-case-for-using-preos-and-trigger" title="Permalink to this headline"></a></h2>
<h2>21.4. Simple tipical use case for using PreOS and trigger<a class="headerlink" href="#simple-tipical-use-case-for-using-preos-and-trigger" title="Permalink to this headline"></a></h2>
<p>Tipical use case for using PreOS and trigger command include the following steps.</p>
<ol class="arabic">
<li><p class="first">Create PreOS PXE with ssh key and trigger command for installation.</p>
<blockquote>
<div><div class="highlight-sh"><div class="highlight"><pre><span></span>$ cdist preos ubuntu /preos/ubuntu -b -C <span class="se">\</span>
<div><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ cdist preos ubuntu /preos/ubuntu -b -C <span class="se">\</span>
-k ~/.ssh/id_rsa.pub -p /preos/pxe <span class="se">\</span>
-t <span class="s2">&quot;/usr/bin/curl 192.168.111.5:3000/install/&quot;</span>
</pre></div>
@ -342,7 +340,7 @@ PreOS.</p>
<li><p class="first">On cdist host (192.168.111.5 from above) start trigger command (it will use
default init manifest for installation).</p>
<blockquote>
<div><div class="highlight-sh"><div class="highlight"><pre><span></span>$ cdist trigger -b -v
<div><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ cdist trigger -b -v
</pre></div>
</div>
</div></blockquote>
@ -361,18 +359,16 @@ default init manifest for installation).</p>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-reference.html" class="btn btn-neutral float-right" title="20. Reference" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-integration.html" class="btn btn-neutral float-right" title="22. cdist integration / using cdist as library" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-trigger.html" class="btn btn-neutral" title="18. Trigger" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="cdist-trigger.html" class="btn btn-neutral" title="20. Trigger" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -381,11 +377,11 @@ default init manifest for installation).</p>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -400,35 +396,24 @@ default init manifest for installation).</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>8. Quickstart &mdash; cdist 4.5.0 documentation</title>
<title>8. Quickstart &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="9. cdist(1)" href="man1/cdist.html"/>
<link rel="prev" title="7. Features" href="cdist-features.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="9. Dive into real world cdist" href="cdist-real-world.html" />
<link rel="prev" title="7. Features" href="cdist-features.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,23 +91,28 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">20. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -127,7 +124,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -135,9 +132,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -196,7 +194,7 @@ and usually logs into the <strong>target host</strong> as the
of the target host to allow root logins: Edit
the file <strong>/etc/ssh/sshd_config</strong> and add one of the following
lines:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Allow login only via public key</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Allow login only via public key</span>
<span class="n">PermitRootLogin</span> <span class="n">without</span><span class="o">-</span><span class="n">password</span>
<span class="c1"># Allow login via password and public key</span>
@ -205,7 +203,7 @@ lines:</p>
</div>
<p>As cdist uses ssh intensively, it is recommended to setup authentication
with public keys:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Generate pubkey pair as a normal user</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Generate pubkey pair as a normal user</span>
<span class="n">ssh</span><span class="o">-</span><span class="n">keygen</span>
<span class="c1"># Copy pubkey over to target host</span>
@ -214,7 +212,7 @@ with public keys:</p>
</div>
<p>Have a look at ssh-agent(1) and ssh-add(1) on how to cache the password for
your public key. Usually it looks like this:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span># Start agent and export variables
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># Start agent and export variables
eval `ssh-agent`
# Add keys (requires password for every identity file)
@ -228,7 +226,7 @@ documentation.</p>
<p>As soon as you are able to login without password to localhost,
we can use cdist to configure it. You can copy and paste the following
code into your shell to get started and configure localhost:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Get cdist</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Get cdist</span>
<span class="c1"># Mirrors can be found on</span>
<span class="c1"># http://www.nico.schottelius.org/software/cdist/install/#index2h4</span>
<span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">ungleich</span><span class="o">/</span><span class="n">cdist</span>
@ -256,15 +254,13 @@ to create a more sophisticated configuration.</p>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="man1/cdist.html" class="btn btn-neutral float-right" title="9. cdist(1)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-real-world.html" class="btn btn-neutral float-right" title="9. Dive into real world cdist" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-features.html" class="btn btn-neutral" title="7. Features" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
@ -276,11 +272,11 @@ to create a more sophisticated configuration.</p>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -295,35 +291,24 @@ to create a more sophisticated configuration.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

View File

@ -0,0 +1,814 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>9. Dive into real world cdist &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="10. cdist(1)" href="man1/cdist.html" />
<link rel="prev" title="8. Quickstart" href="cdist-quickstart.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> cdist
</a>
<div class="version">
4.10.5-270-g0dc94fb5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="cdist-intro.html">1. cdist - usable configuration management</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-why.html">2. Why should I use cdist?</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-os.html">3. Supported Operating Systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-install.html">4. How to install cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-update.html">5. How to update cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">9. Dive into real world cdist</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#introduction">9.1. Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="#creating-type-layout">9.2. Creating type layout</a></li>
<li class="toctree-l2"><a class="reference internal" href="#creating-sample-bottle-hosting-type-parameters">9.3. Creating __sample_bottle_hosting type parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="#creating-sample-bottle-hosting-type-manifest">9.4. Creating __sample_bottle_hosting type manifest</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#creating-user-and-user-directories">9.4.1. Creating user and user directories</a></li>
<li class="toctree-l3"><a class="reference internal" href="#installing-packages">9.4.2. Installing packages</a></li>
<li class="toctree-l3"><a class="reference internal" href="#creating-postgresql-database">9.4.3. Creating PostgreSQL database</a></li>
<li class="toctree-l3"><a class="reference internal" href="#configuring-uwsgi">9.4.4. Configuring uWSGI</a></li>
<li class="toctree-l3"><a class="reference internal" href="#configuring-nginx-for-let-s-encrypt-and-https-redirection">9.4.5. Configuring nginx for Let's Encrypt and HTTPS redirection</a></li>
<li class="toctree-l3"><a class="reference internal" href="#configuring-certificate-creation">9.4.6. Configuring certificate creation</a></li>
<li class="toctree-l3"><a class="reference internal" href="#configuring-nginx-https-server-with-uwsgi-upstream">9.4.7. Configuring nginx HTTPS server with uWSGI upstream</a></li>
<li class="toctree-l3"><a class="reference internal" href="#complete-sample-bottle-hosting-type-manifest-listing">9.4.8. Complete __sample_bottle_hosting type manifest listing</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#creating-sample-bottle-hosting-type-gencode-remote">9.5. Creating __sample_bottle_hosting type gencode-remote</a></li>
<li class="toctree-l2"><a class="reference internal" href="#creating-sample-nginx-http-letsencrypt-and-ssl-redirect-type">9.6. Creating __sample_nginx_http_letsencrypt_and_ssl_redirect type</a></li>
<li class="toctree-l2"><a class="reference internal" href="#creating-init-manifest">9.7. Creating init manifest</a></li>
<li class="toctree-l2"><a class="reference internal" href="#configuring-host">9.8. Configuring host</a></li>
<li class="toctree-l2"><a class="reference internal" href="#creating-python-bottle-application">9.9. Creating python bottle application</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#preparing-database">9.9.1. Preparing database</a></li>
<li class="toctree-l3"><a class="reference internal" href="#creating-application">9.9.2. Creating application</a></li>
<li class="toctree-l3"><a class="reference internal" href="#openning-application">9.9.3. Openning application</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#what-s-next">9.10. What's next?</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">23. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>9. Dive into real world cdist</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/cdist-real-world.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="dive-into-real-world-cdist">
<h1>9. Dive into real world cdist<a class="headerlink" href="#dive-into-real-world-cdist" title="Permalink to this headline"></a></h1>
<div class="section" id="introduction">
<h2>9.1. Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<p>This walkthrough shows real world cdist configuration example.</p>
<p>Sample target host is named <strong>test.ungleich.ch</strong>.
Just replace <strong>test.ungleich.ch</strong> with your target hostname.</p>
<p>Our goal is to configure python application hosting. For writing sample
application we will use <a class="reference external" href="http://bottlepy.org">Bottle</a> WSGI micro web-framework.
It will use PostgreSQL database and it will list items from <strong>items</strong> table.
It will be served by uWSGI server. We will also use the Nginx web server
as a reverse proxy and we want HTTPS.
For HTTPS we will use Let's Encrypt certificate.</p>
<p>For setting up hosting we want to use cdist so we will write a new type
for that. This type will:</p>
<ul class="simple">
<li>install required packages</li>
<li>create OS user, user home directory and application home directory</li>
<li>create PostgreSQL database</li>
<li>configure uWSGI</li>
<li>configure Let's Encrypt certificate</li>
<li>configure nginx.</li>
</ul>
<p>Our type will not create the actual python application. Its intention is only
to configure hosing for specified user and project. It is up to the user to
create his/her applications.</p>
<p>So let's start.</p>
</div>
<div class="section" id="creating-type-layout">
<h2>9.2. Creating type layout<a class="headerlink" href="#creating-type-layout" title="Permalink to this headline"></a></h2>
<p>We will create a new custom type. Let's call it <strong>__sample_bottle_hosting</strong>.</p>
<p>Go to <strong>~/.cdist/type</strong> directory (create it if it does not exist) and create
new type layout:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">~/.</span><span class="n">cdist</span><span class="o">/</span><span class="nb">type</span>
<span class="n">mkdir</span> <span class="n">__sample_bottle_hosting</span>
<span class="n">cd</span> <span class="n">__sample_bottle_hosting</span>
<span class="n">touch</span> <span class="n">manifest</span> <span class="n">gencode</span><span class="o">-</span><span class="n">remote</span>
<span class="n">mkdir</span> <span class="n">parameter</span>
<span class="n">touch</span> <span class="n">parameter</span><span class="o">/</span><span class="n">required</span>
</pre></div>
</div>
</div>
<div class="section" id="creating-sample-bottle-hosting-type-parameters">
<h2>9.3. Creating __sample_bottle_hosting type parameters<a class="headerlink" href="#creating-sample-bottle-hosting-type-parameters" title="Permalink to this headline"></a></h2>
<p>Our type will be configurable through the means of parameters. Let's define
the following parameters:</p>
<dl class="docutils">
<dt>projectname</dt>
<dd>name for the project, needed for uWSGI ini file</dd>
<dt>user</dt>
<dd>user name</dd>
<dt>domain</dt>
<dd>target host domain, needed for Let's Encrypt certificate.</dd>
</dl>
<p>We define parameters to make our type reusable for different projects, user and domain.</p>
<p>Define required parameters:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">printf</span> <span class="s2">&quot;projectname</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">&gt;&gt;</span> <span class="n">parameter</span><span class="o">/</span><span class="n">required</span>
<span class="n">printf</span> <span class="s2">&quot;user</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">&gt;&gt;</span> <span class="n">parameter</span><span class="o">/</span><span class="n">required</span>
<span class="n">printf</span> <span class="s2">&quot;domain</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">&gt;&gt;</span> <span class="n">parameter</span><span class="o">/</span><span class="n">required</span>
</pre></div>
</div>
<p>For details on type parameters see <a class="reference external" href="cdist-type.html#defining-parameters">Defining parameters</a>.</p>
</div>
<div class="section" id="creating-sample-bottle-hosting-type-manifest">
<h2>9.4. Creating __sample_bottle_hosting type manifest<a class="headerlink" href="#creating-sample-bottle-hosting-type-manifest" title="Permalink to this headline"></a></h2>
<p>Next step is to define manifest (~/.cdist/type/__sample_bottle_hosting/manifest).
We also want our type to currently support only Devuan. So we will start by
checking target host OS. We will use <a class="reference external" href="cdist-reference.html#explorers">os</a>
global explorer:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>os=$(cat &quot;$__global/explorer/os&quot;)
case &quot;$os&quot; in
devuan)
:
;;
*)
echo &quot;OS $os currently not supported&quot; &gt;&amp;2
exit 1
;;
esac
</pre></div>
</div>
<p>If target host OS is not Devuan then we print error message to stderr
and exit. For other OS-es support we should check and change package names
we should install, because packages differ in different OS-es and in different
OS distributions like GNU/Linux distributions. There can also be a different
configuration locations (e.g. nginx config directory could be in /usr/local tree).
If we detected unsupported OS we should error out. cdist will stop configuration
process and output error message.</p>
<div class="section" id="creating-user-and-user-directories">
<h3>9.4.1. Creating user and user directories<a class="headerlink" href="#creating-user-and-user-directories" title="Permalink to this headline"></a></h3>
<p>Then we create user and his/her home directory and application home directory.
We will use existing cdist types <a class="reference external" href="man7/cdist-type__user.html">__user</a> and <a class="reference external" href="man7/cdist-type__directory.html">__directory</a>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>user=&quot;$(cat &quot;$__object/parameter/user&quot;)&quot;
home=&quot;/home/$user&quot;
apphome=&quot;$home/app&quot;
# create user
__user &quot;$user&quot; --home &quot;$home&quot; --shell /bin/bash
# create user home dir
require=&quot;__user/$user&quot; __directory &quot;$home&quot; \
--owner &quot;$user&quot; --group &quot;$user&quot; --mode 0755
# create app home dir
require=&quot;__user/$user __directory/$home&quot; __directory &quot;$apphome&quot; \
--state present --owner &quot;$user&quot; --group &quot;$user&quot; --mode 0755
</pre></div>
</div>
<p>First we define <em>user</em>, <em>home</em> and <em>apphome</em> variables. User is defined by type's
<strong>user</strong> parameter. Here we use <strong>require</strong> which is cdist's way to define dependencies.
User home directory should be created <strong>after</strong> user is created. And application
home directory is created <strong>after</strong> both user and user home directory are created.
For details on <strong>require</strong> see <a class="reference external" href="cdist-manifest.html#dependencies">Dependencies</a>.</p>
</div>
<div class="section" id="installing-packages">
<h3>9.4.2. Installing packages<a class="headerlink" href="#installing-packages" title="Permalink to this headline"></a></h3>
<p>Install required packages using existing <a class="reference external" href="man7/cdist-type__package.html">__package</a> type.
Before installing package we want to update apt package index using
<a class="reference external" href="man7/cdist-type__apt_update_index.html">__apt_update_index</a>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># define packages that need to be installed
packages_to_install=&quot;nginx uwsgi-plugin-python3 python3-dev python3-pip postgresql postgresql-contrib libpq-dev python3-venv uwsgi python3-psycopg2&quot;
# update package index
__apt_update_index
# install packages
for package in $packages_to_install
do require=&quot;__apt_update_index&quot; __package $package --state=present
done
</pre></div>
</div>
<p>Here we use shell for loop. It executes <strong>require=&quot;__apt_update_index&quot; __package</strong>
for each member in a list we define in <strong>packages_to_install</strong> variable.
This is much nicer then having as many <strong>require=&quot;__apt_update_index&quot; __package</strong>
lines as there are packages we want to install.</p>
<p>For python packages we use <a class="reference external" href="man7/cdist-type__package_pip.html">__package_pip</a>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># install pip3 packages
for package in bottle bottle-pgsql; do
__package_pip --pip pip3 $package
done
</pre></div>
</div>
</div>
<div class="section" id="creating-postgresql-database">
<h3>9.4.3. Creating PostgreSQL database<a class="headerlink" href="#creating-postgresql-database" title="Permalink to this headline"></a></h3>
<p>Create PostgreSQL database using <a class="reference external" href="man7/cdist-type__postgres_database.html">__postgres_database</a>
and <a class="reference external" href="man7/cdist-type__postgres_role.html">__postgres_role</a> for creating database user:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#PostgreSQL db &amp; user
postgres_server=postgresql
# create PostgreSQL db user
require=&quot;__package/postgresql&quot; __postgres_role $user --login --createdb
# create PostgreSQL db
require=&quot;__postgres_role/$user __package/postgresql&quot; __postgres_database $user \
--owner $user
</pre></div>
</div>
</div>
<div class="section" id="configuring-uwsgi">
<h3>9.4.4. Configuring uWSGI<a class="headerlink" href="#configuring-uwsgi" title="Permalink to this headline"></a></h3>
<p>Configure uWSGI using <a class="reference external" href="man7/cdist-type__file.html">__file</a> type:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># configure uWSGI
projectname=&quot;$(cat &quot;$__object/parameter/projectname&quot;)&quot;
require=&quot;__package/uwsgi&quot; __file /etc/uwsgi/apps-enabled/$user.ini \
--owner root --group root --mode 0644 \
--state present \
--source - &lt;&lt; EOF
[uwsgi]
socket = $apphome/uwsgi.sock
chdir = $apphome
wsgi-file = $projectname/wsgi.py
touch-reload = $projectname/wsgi.py
processes = 4
threads = 2
chmod-socket = 666
daemonize=true
vacuum = true
uid = $user
gid = $user
EOF
</pre></div>
</div>
<p>We require package uWSGI present in order to create <strong>/etc/uwsgi/apps-enabled/$user.ini</strong> file.
Installation of uWSGI also creates configuration layout: <strong>/etc/uwsgi/apps-enabled</strong>.
If this directory does not exist then <strong>__file</strong> type would error.
We also use stdin as file content source. For details see <a class="reference external" href="cdist-type.html#input-from-stdin">Input from stdin</a>.
For feading stdin we use here-document (<strong>&lt;&lt;</strong> operator). It allows redirection of subsequent
lines read by the shell to the input of a command until a line containing only the delimiter
and a newline, with no blank characters in between (EOF in our case).</p>
</div>
<div class="section" id="configuring-nginx-for-let-s-encrypt-and-https-redirection">
<h3>9.4.5. Configuring nginx for Let's Encrypt and HTTPS redirection<a class="headerlink" href="#configuring-nginx-for-let-s-encrypt-and-https-redirection" title="Permalink to this headline"></a></h3>
<p>Next configure nginx for Let's Encrypt and for HTTP -&gt; HTTPS redirection. For this
purpose we will create new type <strong>__sample_nginx_http_letsencrypt_and_ssl_redirect</strong>
and use it here:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>domain=&quot;$(cat &quot;$__object/parameter/domain&quot;)&quot;
webroot=&quot;/var/www/html&quot;
__sample_nginx_http_letsencrypt_and_ssl_redirect &quot;$domain&quot; --webroot &quot;$webroot&quot;
</pre></div>
</div>
</div>
<div class="section" id="configuring-certificate-creation">
<h3>9.4.6. Configuring certificate creation<a class="headerlink" href="#configuring-certificate-creation" title="Permalink to this headline"></a></h3>
<p>After HTTP nginx configuration we will create Let's Encrypt certificate using
<a class="reference external" href="man7/cdist-type__letsencrypt_cert.html">__letsencrypt_cert</a> type.
For Let's Encrypt cert configuration ensure that there is a DNS entry for your
domain. We assure that cert creation is applied after nginx HTTP is configured
for Let's Encrypt to work:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># create SSL cert</span>
<span class="n">require</span><span class="o">=</span><span class="s2">&quot;__package/nginx __sample_nginx_http_letsencrypt_and_ssl_redirect/$domain&quot;</span> \
<span class="n">__letsencrypt_cert</span> <span class="o">--</span><span class="n">admin</span><span class="o">-</span><span class="n">email</span> <span class="n">admin</span><span class="nd">@test</span><span class="o">.</span><span class="n">ungleich</span><span class="o">.</span><span class="n">ch</span> \
<span class="o">--</span><span class="n">webroot</span> <span class="s2">&quot;$webroot&quot;</span> \
<span class="o">--</span><span class="n">automatic</span><span class="o">-</span><span class="n">renewal</span> \
<span class="o">--</span><span class="n">renew</span><span class="o">-</span><span class="n">hook</span> <span class="s2">&quot;service nginx reload&quot;</span> \
<span class="o">--</span><span class="n">domain</span> <span class="s2">&quot;$domain&quot;</span> \
<span class="s2">&quot;$domain&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="configuring-nginx-https-server-with-uwsgi-upstream">
<h3>9.4.7. Configuring nginx HTTPS server with uWSGI upstream<a class="headerlink" href="#configuring-nginx-https-server-with-uwsgi-upstream" title="Permalink to this headline"></a></h3>
<p>Then we can configure nginx HTTPS server that will use created Let's Encrypt certificate:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># configure nginx
require=&quot;__package/nginx __letsencrypt_cert/$domain&quot; \
__file &quot;/etc/nginx/sites-enabled/https-$domain&quot; \
--source - --mode 0644 &lt;&lt; EOF
upstream _bottle {
server unix:$apphome/uwsgi.sock;
}
server {
listen 443;
listen [::]:443;
server_name $domain;
access_log /var/log/nginx/access.log;
ssl on;
ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;
client_max_body_size 256m;
location / {
try_files \$uri @uwsgi;
}
location @uwsgi {
include uwsgi_params;
uwsgi_pass _bottle;
}
}
EOF
</pre></div>
</div>
<p>Now our manifest is finished.</p>
</div>
<div class="section" id="complete-sample-bottle-hosting-type-manifest-listing">
<h3>9.4.8. Complete __sample_bottle_hosting type manifest listing<a class="headerlink" href="#complete-sample-bottle-hosting-type-manifest-listing" title="Permalink to this headline"></a></h3>
<p>Here is complete __sample_bottle_hosting type manifest listing,
located in ~/.cdist/type/__sample_bottle_hosting/manifest:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#!/bin/sh
os=$(cat &quot;$__global/explorer/os&quot;)
case &quot;$os&quot; in
devuan)
:
;;
*)
echo &quot;OS $os currently not supported&quot; &gt;&amp;2
exit 1
;;
esac
projectname=&quot;$(cat &quot;$__object/parameter/projectname&quot;)&quot;
user=&quot;$(cat &quot;$__object/parameter/user&quot;)&quot;
home=&quot;/home/$user&quot;
apphome=&quot;$home/app&quot;
domain=&quot;$(cat &quot;$__object/parameter/domain&quot;)&quot;
# create user
__user &quot;$user&quot; --home &quot;$home&quot; --shell /bin/bash
# create user home dir
require=&quot;__user/$user&quot; __directory &quot;$home&quot; \
--owner &quot;$user&quot; --group &quot;$user&quot; --mode 0755
# create app home dir
require=&quot;__user/$user __directory/$home&quot; __directory &quot;$apphome&quot; \
--state present --owner &quot;$user&quot; --group &quot;$user&quot; --mode 0755
# define packages that need to be installed
packages_to_install=&quot;nginx uwsgi-plugin-python3 python3-dev python3-pip postgresql postgresql-contrib libpq-dev python3-venv uwsgi python3-psycopg2&quot;
# update package index
__apt_update_index
# install packages
for package in $packages_to_install
do require=&quot;__apt_update_index&quot; __package $package --state=present
done
# install pip3 packages
for package in bottle bottle-pgsql; do
__package_pip --pip pip3 $package
done
#PostgreSQL db &amp; user
postgres_server=postgresql
# create PostgreSQL db user
require=&quot;__package/postgresql&quot; __postgres_role $user --login --createdb
# create PostgreSQL db
require=&quot;__postgres_role/$user __package/postgresql&quot; __postgres_database $user \
--owner $user
# configure uWSGI
require=&quot;__package/uwsgi&quot; __file /etc/uwsgi/apps-enabled/$user.ini \
--owner root --group root --mode 0644 \
--state present \
--source - &lt;&lt; EOF
[uwsgi]
socket = $apphome/uwsgi.sock
chdir = $apphome
wsgi-file = $projectname/wsgi.py
touch-reload = $projectname/wsgi.py
processes = 4
threads = 2
chmod-socket = 666
daemonize=true
vacuum = true
uid = $user
gid = $user
EOF
# setup nginx HTTP for Let&#39;s Encrypt and SSL redirect
domain=&quot;$(cat &quot;$__object/parameter/domain&quot;)&quot;
webroot=&quot;/var/www/html&quot;
__sample_nginx_http_letsencrypt_and_ssl_redirect &quot;$domain&quot; --webroot &quot;$webroot&quot;
# create SSL cert
require=&quot;__package/nginx __sample_nginx_http_letsencrypt_and_ssl_redirect/$domain&quot; \
__letsencrypt_cert --admin-email admin@test.ungleich.ch \
--webroot &quot;$webroot&quot; \
--automatic-renewal \
--renew-hook &quot;service nginx reload&quot; \
--domain &quot;$domain&quot; \
&quot;$domain&quot;
# configure nginx
require=&quot;__package/nginx __letsencrypt_cert/$domain&quot; \
__file &quot;/etc/nginx/sites-enabled/https-$domain&quot; \
--source - --mode 0644 &lt;&lt; EOF
upstream _bottle {
server unix:$apphome/uwsgi.sock;
}
server {
listen 443;
listen [::]:443;
server_name $domain;
access_log /var/log/nginx/access.log;
ssl on;
ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;
client_max_body_size 256m;
location / {
try_files \$uri @uwsgi;
}
location @uwsgi {
include uwsgi_params;
uwsgi_pass _bottle;
}
}
EOF
</pre></div>
</div>
</div>
</div>
<div class="section" id="creating-sample-bottle-hosting-type-gencode-remote">
<h2>9.5. Creating __sample_bottle_hosting type gencode-remote<a class="headerlink" href="#creating-sample-bottle-hosting-type-gencode-remote" title="Permalink to this headline"></a></h2>
<p>Now define <strong>gencode-remote</strong> script: ~/.cdist/type/__sample_bottle_hosting/gencode-remote.
After manifest is applied it should restart uWSGI and nginx services so that our
configuration is active. Our gencode-remote looks like the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">echo</span> <span class="s2">&quot;service uwsgi restart&quot;</span>
<span class="n">echo</span> <span class="s2">&quot;service nginx restart&quot;</span>
</pre></div>
</div>
<p>Our <strong>__sample_bottle_hosting</strong> type is now finished.</p>
</div>
<div class="section" id="creating-sample-nginx-http-letsencrypt-and-ssl-redirect-type">
<h2>9.6. Creating __sample_nginx_http_letsencrypt_and_ssl_redirect type<a class="headerlink" href="#creating-sample-nginx-http-letsencrypt-and-ssl-redirect-type" title="Permalink to this headline"></a></h2>
<p>Let's now create <strong>__sample_nginx_http_letsencrypt_and_ssl_redirect</strong> type:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">~/.</span><span class="n">cdist</span><span class="o">/</span><span class="nb">type</span>
<span class="n">mkdir</span> <span class="n">__sample_nginx_http_letsencrypt_and_ssl_redirect</span>
<span class="n">cd</span> <span class="n">__sample_nginx_http_letsencrypt_and_ssl_redirect</span>
<span class="n">mkdir</span> <span class="n">parameter</span>
<span class="n">echo</span> <span class="n">webroot</span> <span class="o">&gt;</span> <span class="n">parameter</span><span class="o">/</span><span class="n">required</span>
<span class="n">touch</span> <span class="n">manifest</span>
<span class="n">touch</span> <span class="n">gencode</span><span class="o">-</span><span class="n">remote</span>
</pre></div>
</div>
<p>Edit manifest:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>domain=&quot;$__object_id&quot;
webroot=&quot;$(cat &quot;$__object/parameter/webroot&quot;)&quot;
# make sure we have nginx package
__package nginx
# setup Let&#39;s Encrypt HTTP acme challenge, redirect HTTP to HTTPS
require=&quot;__package/nginx&quot; __file &quot;/etc/nginx/sites-enabled/http-$domain&quot; \
--source - --mode 0644 &lt;&lt; EOF
server {
listen *:80;
listen [::]:80;
server_name $domain;
# Let&#39;s Encrypt
location /.well-known/acme-challenge/ {
root $webroot;
}
# Everything else -&gt; SSL
location / {
return 301 https://\$host\$request_uri;
}
}
EOF
</pre></div>
</div>
<p>Edit gencode-remote:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">echo</span> <span class="s2">&quot;service nginx reload&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="creating-init-manifest">
<h2>9.7. Creating init manifest<a class="headerlink" href="#creating-init-manifest" title="Permalink to this headline"></a></h2>
<p>Next create init manifest:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">~/.</span><span class="n">cdist</span><span class="o">/</span><span class="n">manifest</span>
<span class="n">printf</span> <span class="s2">&quot;__sample_bottle_hosting --projectname sample --user app --domain \$__target_host sample</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">&gt;</span> <span class="n">sample</span>
</pre></div>
</div>
<p>Using this init manifest our target host will be configured using our <strong>__sample_bottle_hosting</strong>
type with projectname <em>sample</em>, user <em>app</em> and domain equal to <strong>__target_host</strong>.
Here the last positional argument <em>sample</em> is type's object id. For details on
<strong>__target_host</strong> and <strong>__object_id</strong> see
<a class="reference external" href="cdist-reference.html#environment-variables-for-reading">Environment variables (for reading)</a>
reference.</p>
</div>
<div class="section" id="configuring-host">
<h2>9.8. Configuring host<a class="headerlink" href="#configuring-host" title="Permalink to this headline"></a></h2>
<p>Finally configure test.ungleich.ch:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cdist</span> <span class="n">config</span> <span class="o">-</span><span class="n">v</span> <span class="o">-</span><span class="n">i</span> <span class="o">~/.</span><span class="n">cdist</span><span class="o">/</span><span class="n">manifest</span><span class="o">/</span><span class="n">sample</span> <span class="n">test</span><span class="o">.</span><span class="n">ungleich</span><span class="o">.</span><span class="n">ch</span>
</pre></div>
</div>
<p>After cdist configuration is successfully finished our host is ready.</p>
</div>
<div class="section" id="creating-python-bottle-application">
<h2>9.9. Creating python bottle application<a class="headerlink" href="#creating-python-bottle-application" title="Permalink to this headline"></a></h2>
<p>We now need to create Bottle application. As you remember from the beginning
of this walkthrough our type does not create the actual python application,
its intention is only to configure hosing for specified user and project.
It is up to the user to create his/her applications.</p>
<p>Become app user:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">su</span> <span class="o">-</span><span class="n">l</span> <span class="n">app</span>
</pre></div>
</div>
<div class="section" id="preparing-database">
<h3>9.9.1. Preparing database<a class="headerlink" href="#preparing-database" title="Permalink to this headline"></a></h3>
<p>We need to prepare database for our application. Create table and
insert some items:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">psql</span> <span class="o">-</span><span class="n">c</span> <span class="s2">&quot;create table items (item varchar(255));&quot;</span>
<span class="n">psql</span> <span class="o">-</span><span class="n">c</span> <span class="s2">&quot;insert into items(item) values(&#39;spam&#39;);&quot;</span>
<span class="n">psql</span> <span class="o">-</span><span class="n">c</span> <span class="s2">&quot;insert into items(item) values(&#39;eggs&#39;);&quot;</span>
<span class="n">psql</span> <span class="o">-</span><span class="n">c</span> <span class="s2">&quot;insert into items(item) values(&#39;sausage&#39;);&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="creating-application">
<h3>9.9.2. Creating application<a class="headerlink" href="#creating-application" title="Permalink to this headline"></a></h3>
<p>Next create sample app:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">app</span><span class="o">/</span><span class="n">app</span>
<span class="n">mkdir</span> <span class="n">sample</span>
<span class="n">cd</span> <span class="n">sample</span>
</pre></div>
</div>
<p>Create app.py with the following content:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env python3</span>
<span class="kn">import</span> <span class="nn">bottle</span>
<span class="kn">import</span> <span class="nn">bottle_pgsql</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">application</span> <span class="o">=</span> <span class="n">bottle</span><span class="o">.</span><span class="n">Bottle</span><span class="p">()</span>
<span class="n">plugin</span> <span class="o">=</span> <span class="n">bottle_pgsql</span><span class="o">.</span><span class="n">Plugin</span><span class="p">(</span><span class="s1">&#39;dbname=app user=app password=&#39;</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">plugin</span><span class="p">)</span>
<span class="nd">@app</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">show_index</span><span class="p">(</span><span class="n">db</span><span class="p">):</span>
<span class="n">db</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s1">&#39;select * from items&#39;</span><span class="p">)</span>
<span class="n">items</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">fetchall</span><span class="p">()</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="n">rv</span> <span class="o">=</span> <span class="s1">&#39;&lt;html&gt;&lt;body&gt;&lt;h3&gt;Items:&lt;/h3&gt;&lt;ul&gt;&#39;</span>
<span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">items</span><span class="p">:</span>
<span class="n">rv</span> <span class="o">+=</span> <span class="s1">&#39;&lt;li&gt;&#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="s1">&#39;item&#39;</span><span class="p">])</span> <span class="o">+</span> <span class="s1">&#39;&lt;/li&gt;&#39;</span>
<span class="n">rv</span> <span class="o">+=</span> <span class="s1">&#39;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;&#39;</span>
<span class="k">return</span> <span class="n">rv</span>
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">bottle</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">app</span><span class="o">=</span><span class="n">app</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s1">&#39;0.0.0.0&#39;</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">8080</span><span class="p">)</span>
</pre></div>
</div>
<p>Create wsgi.py with the following content:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>
<span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="vm">__file__</span><span class="p">))</span>
<span class="kn">import</span> <span class="nn">app</span>
<span class="n">application</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">app</span>
</pre></div>
</div>
<p>We have configured uWSGI with <strong>touch-reload = $projectname/wsgi.py</strong> so after
we have changed our <strong>wsgi.py</strong> file uWSGI reloads the application.</p>
<p>Our application selects and lists items from <strong>items</strong> table.</p>
</div>
<div class="section" id="openning-application">
<h3>9.9.3. Openning application<a class="headerlink" href="#openning-application" title="Permalink to this headline"></a></h3>
<p>Finally try the application:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">test</span><span class="o">.</span><span class="n">ungleich</span><span class="o">.</span><span class="n">ch</span><span class="o">/</span>
</pre></div>
</div>
<p>It should redirect to HTTPS and return:</p>
<div class="highlight docutils container">
<h3>Items:</h3>
<ul>
<li>spam</li>
<li>eggs</li>
<li>sausage</li>
</ul></div>
</div>
</div>
<div class="section" id="what-s-next">
<h2>9.10. What's next?<a class="headerlink" href="#what-s-next" title="Permalink to this headline"></a></h2>
<p>Continue reading next sections ;)</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="man1/cdist.html" class="btn btn-neutral float-right" title="10. cdist(1)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-quickstart.html" class="btn btn-neutral" title="8. Quickstart" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>20. Reference &mdash; cdist 4.5.0 documentation</title>
<title>23. Reference &mdash; cdist 4.10.5-270-g0dc94fb5 documentation</title>
@ -24,27 +24,19 @@
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="cdist 4.5.0 documentation" href="index.html"/>
<link rel="next" title="21. Best practice" href="cdist-best-practice.html"/>
<link rel="prev" title="19. PreOS" href="cdist-preos.html"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="24. Best practice" href="cdist-best-practice.html" />
<link rel="prev" title="22. cdist integration / using cdist as library" href="cdist-integration.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
@ -66,7 +58,7 @@
<div class="version">
4.5.0
4.10.5-270-g0dc94fb5
</div>
@ -99,31 +91,36 @@
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">7. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">8. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">10. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">11. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">12. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">13. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">14. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">15. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">16. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">17. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">18. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">19. PreOS</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">20. Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#explorers">20.1. Explorers</a></li>
<li class="toctree-l2"><a class="reference internal" href="#paths">20.2. Paths</a></li>
<li class="toctree-l2"><a class="reference internal" href="#types">20.3. Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="#objects">20.4. Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="#environment-variables-for-reading">20.5. Environment variables (for reading)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#environment-variables-for-writing">20.6. Environment variables (for writing)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">9. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">10. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">11. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">12. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">13. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">14. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">15. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">16. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">17. Messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-parallelization.html">18. Parallelization</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">19. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-trigger.html">20. Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">22. cdist integration / using cdist as library</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">23. Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#explorers">23.1. Explorers</a></li>
<li class="toctree-l2"><a class="reference internal" href="#paths">23.2. Paths</a></li>
<li class="toctree-l2"><a class="reference internal" href="#types">23.3. Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="#objects">23.4. Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="#environment-variables-for-reading">23.5. Environment variables (for reading)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#environment-variables-for-writing">23.6. Environment variables (for writing)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">21. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">22. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">23. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">24. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">25. Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">24. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">25. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">26. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">27. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">28. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">29. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">30. Troubleshooting</a></li>
</ul>
@ -135,7 +132,7 @@
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">cdist</a>
@ -143,9 +140,10 @@
</nav>
<div class="wy-nav-content">
<div class="rst-content">
@ -168,7 +166,7 @@
<li><a href="index.html">Docs</a> &raquo;</li>
<li>20. Reference</li>
<li>23. Reference</li>
<li class="wy-breadcrumbs-aside">
@ -188,10 +186,10 @@
<div itemprop="articleBody">
<div class="section" id="reference">
<h1>20. Reference<a class="headerlink" href="#reference" title="Permalink to this headline"></a></h1>
<h1>23. Reference<a class="headerlink" href="#reference" title="Permalink to this headline"></a></h1>
<p>Variable, path and type reference for cdist</p>
<div class="section" id="explorers">
<h2>20.1. Explorers<a class="headerlink" href="#explorers" title="Permalink to this headline"></a></h2>
<h2>23.1. Explorers<a class="headerlink" href="#explorers" title="Permalink to this headline"></a></h2>
<p>The following global explorers are available:</p>
<ul class="simple">
<li>cpu_cores</li>
@ -200,6 +198,7 @@
<li>hostname</li>
<li>init</li>
<li>interfaces</li>
<li>is-freebsd-jail</li>
<li>kernel_name</li>
<li>lsb_codename</li>
<li>lsb_description</li>
@ -209,12 +208,13 @@
<li>machine_type</li>
<li>memory</li>
<li>os</li>
<li>os_release</li>
<li>os_version</li>
<li>runlevel</li>
</ul>
</div>
<div class="section" id="paths">
<h2>20.2. Paths<a class="headerlink" href="#paths" title="Permalink to this headline"></a></h2>
<h2>23.2. Paths<a class="headerlink" href="#paths" title="Permalink to this headline"></a></h2>
<dl class="docutils">
<dt>$HOME/.cdist</dt>
<dd>The standard cdist configuration directory relative to your home directory.
@ -225,6 +225,8 @@ This contains types and explorers to be used.</dd>
<dt>cdist/inventory/</dt>
<dd>The distribution inventory directory.
This path is relative to cdist installation directory.</dd>
<dt>cdist/preos/</dt>
<dd>The distribution PreOS plugins directory.</dd>
<dt>confdir</dt>
<dd>Cdist will use all available configuration directories and create
a temporary confdir containing links to the real configuration directories.
@ -295,9 +297,11 @@ This directory is referenced by the variable __object (see below).</dd>
</dl>
</div>
<div class="section" id="types">
<h2>20.3. Types<a class="headerlink" href="#types" title="Permalink to this headline"></a></h2>
<h2>23.3. Types<a class="headerlink" href="#types" title="Permalink to this headline"></a></h2>
<p>The following types are available:</p>
<ul class="simple">
<li>__acl (<a class="reference external" href="man7/cdist-type__acl.html">cdist-type__acl(7)</a>)</li>
<li>__apt_default_release (<a class="reference external" href="man7/cdist-type__apt_default_release.html">cdist-type__apt_default_release(7)</a>)</li>
<li>__apt_key (<a class="reference external" href="man7/cdist-type__apt_key.html">cdist-type__apt_key(7)</a>)</li>
<li>__apt_key_uri (<a class="reference external" href="man7/cdist-type__apt_key_uri.html">cdist-type__apt_key_uri(7)</a>)</li>
<li>__apt_mark (<a class="reference external" href="man7/cdist-type__apt_mark.html">cdist-type__apt_mark(7)</a>)</li>
@ -334,6 +338,10 @@ This directory is referenced by the variable __object (see below).</dd>
<li>__directory (<a class="reference external" href="man7/cdist-type__directory.html">cdist-type__directory(7)</a>)</li>
<li>__docker (<a class="reference external" href="man7/cdist-type__docker.html">cdist-type__docker(7)</a>)</li>
<li>__docker_compose (<a class="reference external" href="man7/cdist-type__docker_compose.html">cdist-type__docker_compose(7)</a>)</li>
<li>__docker_config (<a class="reference external" href="man7/cdist-type__docker_config.html">cdist-type__docker_config(7)</a>)</li>
<li>__docker_secret (<a class="reference external" href="man7/cdist-type__docker_secret.html">cdist-type__docker_secret(7)</a>)</li>
<li>__docker_stack (<a class="reference external" href="man7/cdist-type__docker_stack.html">cdist-type__docker_stack(7)</a>)</li>
<li>__docker_swarm (<a class="reference external" href="man7/cdist-type__docker_swarm.html">cdist-type__docker_swarm(7)</a>)</li>
<li>__dog_vdi (<a class="reference external" href="man7/cdist-type__dog_vdi.html">cdist-type__dog_vdi(7)</a>)</li>
<li>__dot_file (<a class="reference external" href="man7/cdist-type__dot_file.html">cdist-type__dot_file(7)</a>)</li>
<li>__file (<a class="reference external" href="man7/cdist-type__file.html">cdist-type__file(7)</a>)</li>
@ -351,6 +359,7 @@ This directory is referenced by the variable __object (see below).</dd>
<li>__install_chroot_mount (<a class="reference external" href="man7/cdist-type__install_chroot_mount.html">cdist-type__install_chroot_mount(7)</a>)</li>
<li>__install_chroot_umount (<a class="reference external" href="man7/cdist-type__install_chroot_umount.html">cdist-type__install_chroot_umount(7)</a>)</li>
<li>__install_config (<a class="reference external" href="man7/cdist-type__install_config.html">cdist-type__install_config(7)</a>)</li>
<li>__install_coreos (<a class="reference external" href="man7/cdist-type__install_coreos.html">cdist-type__install_coreos(7)</a>)</li>
<li>__install_directory (<a class="reference external" href="man7/cdist-type__install_directory.html">cdist-type__install_directory(7)</a>)</li>
<li>__install_file (<a class="reference external" href="man7/cdist-type__install_file.html">cdist-type__install_file(7)</a>)</li>
<li>__install_fstab (<a class="reference external" href="man7/cdist-type__install_fstab.html">cdist-type__install_fstab(7)</a>)</li>
@ -371,6 +380,7 @@ This directory is referenced by the variable __object (see below).</dd>
<li>__jail_freebsd9 (<a class="reference external" href="man7/cdist-type__jail_freebsd9.html">cdist-type__jail_freebsd9(7)</a>)</li>
<li>__key_value (<a class="reference external" href="man7/cdist-type__key_value.html">cdist-type__key_value(7)</a>)</li>
<li>__keyboard (<a class="reference external" href="man7/cdist-type__keyboard.html">cdist-type__keyboard(7)</a>)</li>
<li>__letsencrypt_cert (<a class="reference external" href="man7/cdist-type__letsencrypt_cert.html">cdist-type__letsencrypt_cert(7)</a>)</li>
<li>__line (<a class="reference external" href="man7/cdist-type__line.html">cdist-type__line(7)</a>)</li>
<li>__link (<a class="reference external" href="man7/cdist-type__link.html">cdist-type__link(7)</a>)</li>
<li>__locale (<a class="reference external" href="man7/cdist-type__locale.html">cdist-type__locale(7)</a>)</li>
@ -399,6 +409,7 @@ This directory is referenced by the variable __object (see below).</dd>
<li>__pacman_conf_integrate (<a class="reference external" href="man7/cdist-type__pacman_conf_integrate.html">cdist-type__pacman_conf_integrate(7)</a>)</li>
<li>__pf_apply (<a class="reference external" href="man7/cdist-type__pf_apply.html">cdist-type__pf_apply(7)</a>)</li>
<li>__pf_ruleset (<a class="reference external" href="man7/cdist-type__pf_ruleset.html">cdist-type__pf_ruleset(7)</a>)</li>
<li>__ping (<a class="reference external" href="man7/cdist-type__ping.html">cdist-type__ping(7)</a>)</li>
<li>__postfix (<a class="reference external" href="man7/cdist-type__postfix.html">cdist-type__postfix(7)</a>)</li>
<li>__postfix_master (<a class="reference external" href="man7/cdist-type__postfix_master.html">cdist-type__postfix_master(7)</a>)</li>
<li>__postfix_postconf (<a class="reference external" href="man7/cdist-type__postfix_postconf.html">cdist-type__postfix_postconf(7)</a>)</li>
@ -409,6 +420,7 @@ This directory is referenced by the variable __object (see below).</dd>
<li>__postgres_role (<a class="reference external" href="man7/cdist-type__postgres_role.html">cdist-type__postgres_role(7)</a>)</li>
<li>__process (<a class="reference external" href="man7/cdist-type__process.html">cdist-type__process(7)</a>)</li>
<li>__prometheus_alertmanager (<a class="reference external" href="man7/cdist-type__prometheus_alertmanager.html">cdist-type__prometheus_alertmanager(7)</a>)</li>
<li>__prometheus_exporter (<a class="reference external" href="man7/cdist-type__prometheus_exporter.html">cdist-type__prometheus_exporter(7)</a>)</li>
<li>__prometheus_server (<a class="reference external" href="man7/cdist-type__prometheus_server.html">cdist-type__prometheus_server(7)</a>)</li>
<li>__pyvenv (<a class="reference external" href="man7/cdist-type__pyvenv.html">cdist-type__pyvenv(7)</a>)</li>
<li>__qemu_img (<a class="reference external" href="man7/cdist-type__qemu_img.html">cdist-type__qemu_img(7)</a>)</li>
@ -424,6 +436,7 @@ This directory is referenced by the variable __object (see below).</dd>
<li>__staged_file (<a class="reference external" href="man7/cdist-type__staged_file.html">cdist-type__staged_file(7)</a>)</li>
<li>__start_on_boot (<a class="reference external" href="man7/cdist-type__start_on_boot.html">cdist-type__start_on_boot(7)</a>)</li>
<li>__sysctl (<a class="reference external" href="man7/cdist-type__sysctl.html">cdist-type__sysctl(7)</a>)</li>
<li>__systemd_unit (<a class="reference external" href="man7/cdist-type__systemd_unit.html">cdist-type__systemd_unit(7)</a>)</li>
<li>__timezone (<a class="reference external" href="man7/cdist-type__timezone.html">cdist-type__timezone(7)</a>)</li>
<li>__update_alternatives (<a class="reference external" href="man7/cdist-type__update_alternatives.html">cdist-type__update_alternatives(7)</a>)</li>
<li>__user (<a class="reference external" href="man7/cdist-type__user.html">cdist-type__user(7)</a>)</li>
@ -434,7 +447,7 @@ This directory is referenced by the variable __object (see below).</dd>
</ul>
</div>
<div class="section" id="objects">
<h2>20.4. Objects<a class="headerlink" href="#objects" title="Permalink to this headline"></a></h2>
<h2>23.4. Objects<a class="headerlink" href="#objects" title="Permalink to this headline"></a></h2>
<p>For object to object communication and tests, the following paths are
usable within a object directory:</p>
<dl class="docutils">
@ -451,9 +464,48 @@ when the type was called.</dd>
</dl>
</div>
<div class="section" id="environment-variables-for-reading">
<h2>20.5. Environment variables (for reading)<a class="headerlink" href="#environment-variables-for-reading" title="Permalink to this headline"></a></h2>
<h2>23.5. Environment variables (for reading)<a class="headerlink" href="#environment-variables-for-reading" title="Permalink to this headline"></a></h2>
<p>The following environment variables are exported by cdist:</p>
<dl class="docutils">
<dt>__cdist_log_level, __cdist_log_level_name</dt>
<dd><p class="first">cdist log level value and cdist log level name. One of:</p>
<table border="1" class="docutils">
<colgroup>
<col width="48%" />
<col width="52%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Log level name</th>
<th class="head">Log level value</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>OFF</td>
<td>60</td>
</tr>
<tr class="row-odd"><td>ERROR</td>
<td>40</td>
</tr>
<tr class="row-even"><td>WARNING</td>
<td>30</td>
</tr>
<tr class="row-odd"><td>INFO</td>
<td>20</td>
</tr>
<tr class="row-even"><td>VERBOSE</td>
<td>15</td>
</tr>
<tr class="row-odd"><td>DEBUG</td>
<td>10</td>
</tr>
<tr class="row-even"><td>TRACE</td>
<td>5</td>
</tr>
</tbody>
</table>
<p class="last">Available for: initial manifest, explorer, type manifest, type explorer,
type gencode.</p>
</dd>
<dt>__explorer</dt>
<dd>Directory that contains all global explorers.
Available for: initial manifest, explorer, type explorer, shell.</dd>
@ -511,11 +563,52 @@ Available for: type explorer.</dd>
</dl>
</div>
<div class="section" id="environment-variables-for-writing">
<h2>20.6. Environment variables (for writing)<a class="headerlink" href="#environment-variables-for-writing" title="Permalink to this headline"></a></h2>
<h2>23.6. Environment variables (for writing)<a class="headerlink" href="#environment-variables-for-writing" title="Permalink to this headline"></a></h2>
<p>The following environment variables influence the behaviour of cdist:</p>
<dl class="docutils">
<dt>require</dt>
<dd>Setup dependencies between objects (see <a class="reference external" href="cdist-manifest.html">cdist manifest</a>).</dd>
<dt>__cdist_log_level</dt>
<dd><p class="first">cdist log level value. One of:</p>
<table border="1" class="docutils">
<colgroup>
<col width="48%" />
<col width="52%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Log level</th>
<th class="head">Log level value</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>OFF</td>
<td>60</td>
</tr>
<tr class="row-odd"><td>ERROR</td>
<td>40</td>
</tr>
<tr class="row-even"><td>WARNING</td>
<td>30</td>
</tr>
<tr class="row-odd"><td>INFO</td>
<td>20</td>
</tr>
<tr class="row-even"><td>VERBOSE</td>
<td>15</td>
</tr>
<tr class="row-odd"><td>DEBUG</td>
<td>10</td>
</tr>
<tr class="row-even"><td>TRACE</td>
<td>5</td>
</tr>
</tbody>
</table>
<p class="last">If set cdist will set this log level in
accordance with configuration rules. If cdist invokation is used
in types then nested cdist will honor this specified log level if
not specified otherwise while invoking it.</p>
</dd>
<dt>CDIST_PATH</dt>
<dd>Colon delimited list of config directories.</dd>
<dt>CDIST_LOCAL_SHELL</dt>
@ -542,18 +635,16 @@ Available for: type explorer.</dd>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="cdist-best-practice.html" class="btn btn-neutral float-right" title="21. Best practice" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-best-practice.html" class="btn btn-neutral float-right" title="24. Best practice" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="cdist-preos.html" class="btn btn-neutral" title="19. PreOS" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="cdist-integration.html" class="btn btn-neutral" title="22. cdist integration / using cdist as library" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -562,11 +653,11 @@ Available for: type explorer.</dd>
<div role="contentinfo">
<p>
&copy; Copyright .
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
@ -581,35 +672,24 @@ Available for: type explorer.</dd>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'4.5.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More