Merge remote-tracking branch 'ungleich/master'

This commit is contained in:
Steven Armstrong 2016-10-05 23:22:44 +02:00
commit 4c1c1e990d
272 changed files with 7930 additions and 2284 deletions

View file

@ -21,6 +21,7 @@
import os
import subprocess
import hashlib
import cdist.version
@ -41,28 +42,48 @@ BANNER = """
"P' "" ""
"""
REMOTE_COPY = "scp -o User=root -q"
REMOTE_EXEC = "ssh -o User=root -q"
REMOTE_COPY = "scp -o User=root"
REMOTE_EXEC = "ssh -o User=root"
class Error(Exception):
"""Base exception class for this project"""
pass
class UnresolvableRequirementsError(cdist.Error):
"""Resolving requirements failed"""
pass
class CdistBetaRequired(cdist.Error):
"""Beta functionality is used but beta is not enabled"""
def __init__(self, command, arg):
self.command = command
self.arg = arg
def __str__(self):
err_msg = ("\'{}\' argument of \'{}\' command is beta, but beta is "
"not enabled. If you want to use it please enable beta "
"functionalities by using the -b/--enable-beta command "
"line flag.")
return err_msg.format(self.arg, self.command)
class CdistObjectError(Error):
"""Something went wrong with an object"""
def __init__(self, cdist_object, message):
self.name = cdist_object.name
self.source = " ".join(cdist_object.source)
self.message = message
def __str__(self):
return '%s: %s (defined at %s)' % (self.name, self.message, self.source)
return '%s: %s (defined at %s)' % (self.name,
self.message,
self.source)
def file_to_list(filename):
"""Return list from \n seperated file"""
@ -77,3 +98,11 @@ def file_to_list(filename):
lines = []
return lines
def str_hash(s):
"""Return hash of string s"""
if isinstance(s, str):
return hashlib.md5(s.encode('utf-8')).hexdigest()
else:
raise Error("Param should be string")

View file

@ -22,6 +22,17 @@
# FIXME: other system types (not linux ...)
if [ -d "/proc/vz" -a ! -d "/proc/bc" ]; then
echo openvz
exit
fi
if [ -e "/proc/1/environ" ] &&
cat "/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container='; then
echo lxc
exit
fi
if [ -r /proc/cpuinfo ]; then
# this should only exist on virtual guest machines,
# tested on vmware, xen, kvm
@ -37,11 +48,12 @@ if [ -r /proc/cpuinfo ]; then
if grep -q -i 'vmware' /sys/class/dmi/id/product_name; then
echo "virtual_by_vmware"
exit
else
if grep -q -i 'bochs' /sys/class/dmi/id/product_name; then
echo "virtual_by_kvm"
exit
fi
elif grep -q -i 'bochs' /sys/class/dmi/id/product_name; then
echo "virtual_by_kvm"
exit
elif grep -q -i 'virtualbox' /sys/class/dmi/id/product_name; then
echo "virtual_by_virtualbox"
exit
fi
fi
fi

View file

@ -39,6 +39,11 @@ if [ -f /etc/cdist-preos ]; then
exit 0
fi
if [ -d /gnu/store ]; then
echo guixsd
exit 0
fi
### Debian and derivatives
if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then
echo ubuntu
@ -72,6 +77,11 @@ if [ -f /etc/owl-release ]; then
fi
### Redhat and derivatives
if grep -q ^Scientific /etc/redhat-release 2>/dev/null; then
echo scientific
exit 0
fi
if grep -q ^CentOS /etc/redhat-release 2>/dev/null; then
echo centos
exit 0

View file

@ -54,7 +54,7 @@ case "$($__explorer/os)" in
owl)
cat /etc/owl-release
;;
redhat|centos|mitel)
redhat|centos|mitel|scientific)
cat /etc/redhat-release
;;
slackware)

View file

@ -1,8 +1,9 @@
cdist-type__apt_key(7)
======================
Manage the list of keys used by apt
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_key - Manage the list of keys used by apt
DESCRIPTION
@ -24,8 +25,8 @@ keyid
the id of the key to add. Defaults to __object_id
keyserver
the keyserver from which to fetch the key. If omitted the default set in
./parameter/default/keyserver is used.
the keyserver from which to fetch the key. If omitted the default set
in ./parameter/default/keyserver is used.
EXAMPLES
@ -47,12 +48,14 @@ EXAMPLES
__apt_key UbuntuArchiveKey --keyid 437D05B5 --keyserver keyserver.ubuntu.com
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-2014 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

@ -1,8 +1,9 @@
cdist-type__apt_key_uri(7)
==========================
Add apt key from uri
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_key_uri - Add apt key from uri
DESCRIPTION
@ -37,12 +38,14 @@ EXAMPLES
--state present
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-2014 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

@ -1,8 +1,9 @@
cdist-type__apt_norecommends(7)
===============================
Configure apt to not install recommended packages
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_norecommends - Configure apt to not install recommended packages
DESCRIPTION
@ -28,12 +29,14 @@ EXAMPLES
__apt_norecommends
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2014 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

@ -1,8 +1,9 @@
cdist-type__apt_ppa(7)
======================
Manage ppa repositories
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_ppa - Manage ppa repositories
DESCRIPTION
@ -36,12 +37,14 @@ EXAMPLES
__apt_ppa ppa:sans-intern/missing-bits --state absent
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-2014 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

@ -1,8 +1,9 @@
cdist-type__apt_source(7)
=========================
Manage apt sources
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_source - Manage apt sources
DESCRIPTION
@ -55,12 +56,14 @@ EXAMPLES
--component partner --state present
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-2014 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

@ -1,8 +1,9 @@
cdist-type__apt_update_index(7)
===============================
Update apt's package index
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__apt_update_index - Update apt's package index
DESCRIPTION
@ -27,12 +28,14 @@ EXAMPLES
__apt_update_index
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011 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

@ -1,8 +1,9 @@
cdist-type__block(7)
====================
Manage blocks of text in files
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__block - Manage blocks of text in files
DESCRIPTION
@ -68,12 +69,14 @@ EXAMPLES
DONE
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2013 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2013 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

@ -1,8 +1,9 @@
cdist-type__ccollect_source(7)
==============================
Manage ccollect sources
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__ccollect_source - Manage ccollect sources
DESCRIPTION
@ -52,12 +53,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- ccollect(1)
- http://www.nico.schottelius.org/software/ccollect/
:strong:`ccollect`\ (1)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2014 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2014 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.

View file

@ -40,7 +40,9 @@ echo "$source" | __file "$source_file" --source - --state "$state"
################################################################################
# Booleans
if [ -f "$__object/parameter/verbose" ]; then
if [ "${state}" = "absent" ]; then
verbosestate="absent"
elif [ -f "$__object/parameter/verbose" ]; then
verbosestate="present"
else
verbosestate="absent"

View file

@ -1,8 +1,9 @@
cdist-type__cdist(7)
====================
Manage cdist installations
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__cdist - Manage cdist installations
DESCRIPTION
@ -49,12 +50,14 @@ EXAMPLES
__cdist --source "git://git.schottelius.org/cdist" /home/cdist/cdist
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2013 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 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.

View file

@ -1,8 +1,9 @@
cdist-type__cdistmarker(7)
==========================
Add a timestamped cdist marker.
Daniel Maher <phrawzty+cdist--@--gmail.com>
NAME
----
cdist-type__cdistmarker - Add a timestamped cdist marker.
DESCRIPTION
@ -41,12 +42,14 @@ EXAMPLES
__cdistmarker --destination /tmp/cdist_marker --format '+%s'
SEE ALSO
--------
- `cdist-type(7) <cdisty-type.html>`_
AUTHORS
-------
Daniel Maher <phrawzty+cdist--@--gmail.com>
COPYING
-------
Copyright \(C) 2011 Daniel Maher. Free use of this software is granted under
the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011 Daniel Maher. 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

@ -1,8 +1,9 @@
cdist-type__config_file(7)
==========================
Manages config files
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__config_file - _Manages config files
DESCRIPTION
@ -47,11 +48,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__file(7) <cdist-type__file.html>`_
:strong:`cdist-type__file`\ (7)
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul(7)
=====================
Install consul
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul - Install consul
DESCRIPTION
@ -40,12 +41,14 @@ EXAMPLES
--version 0.4.1
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -23,7 +23,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
centos|redhat|ubuntu|debian|archlinux|gentoo)
scientific|centos|redhat|ubuntu|debian|archlinux|gentoo)
# any linux should work
:
;;

View file

@ -1,8 +1,9 @@
cdist-type__consul_agent(7)
===========================
Manage the consul agent
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_agent - Manage the consul agent
DESCRIPTION
@ -110,7 +111,7 @@ enable-syslog
enables logging to syslog
verify-incoming
enforce the use of TLS and verify a client's authenticity on incomming connections
enforce the use of TLS and verify a client's authenticity on incoming connections
verify-outgoing
enforce the use of TLS and verify the peers authenticity on outgoing connections
@ -164,11 +165,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- http://www.consul.io/docs/agent/options.html
consul documentation at: <http://www.consul.io/docs/agent/options.html>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -23,7 +23,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
centos|debian|redhat|ubuntu)
scientific|centos|debian|redhat|ubuntu)
# whitelist safeguard
:
;;

View file

@ -1,8 +1,9 @@
cdist-type__consul_check(7)
=============================
Manages consul checks
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_check - Manages consul checks
DESCRIPTION
@ -10,7 +11,7 @@ DESCRIPTION
Generate and deploy check definitions for a consul agent.
See http://www.consul.io/docs/agent/checks.html for parameter documentation.
Use either script toghether with interval, or use ttl.
Use either script together with interval, or use ttl.
REQUIRED PARAMETERS
@ -85,11 +86,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
:strong:`cdist-type__consul_agent`\ (7)
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015-2016 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015-2016 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

@ -1,8 +1,9 @@
cdist-type__consul_reload(7)
============================
Reload consul
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_reload - Reload consul
DESCRIPTION
@ -28,12 +29,14 @@ EXAMPLES
__consul_reload
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul_service(7)
=============================
Manages consul services
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_service - Manages consul services
DESCRIPTION
@ -65,11 +66,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
:strong:`cdist-type__consul_agent`\ (7)
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul_template(7)
==============================
Manage the consul-template service
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_template - Manage the consul-template service
DESCRIPTION
@ -124,11 +125,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- https://github.com/hashicorp/consul-template
consul documentation at: <https://github.com/hashicorp/consul-template>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
centos|redhat)
scientific|centos|redhat)
# whitelist safeguard
service_onchange='service consul-template status >/dev/null && service consul-template reload || true' \
;;

View file

@ -1,8 +1,9 @@
cdist-type__consul_template_template(7)
=======================================
Manage consul-template templates
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_template_template - Manage consul-template templates
DESCRIPTION
@ -67,12 +68,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_template(7) <cdist-type__consul_template.html>`_
- `cdist-type__consul_template_config(7) <cdist-type__consul_template_config.html>`_
:strong:`cdist-type__consul_template`\ (7), :strong:`cdist-type__consul_template_config`\ (7)
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015-2016 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015-2016 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

@ -1,8 +1,9 @@
cdist-type__consul_watch_checks(7)
==================================
Manages consul checks watches
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_watch_checks - Manages consul checks watches
DESCRIPTION
@ -54,12 +55,19 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
- http://www.consul.io/docs/agent/watches.html
:strong:`cdist-type__consul_agent`\ (7)
consul documentation at: <http://www.consul.io/docs/agent/watches.html>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul_watch_event(7)
=================================
Manages consul event watches
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_watch_event - Manages consul event watches
DESCRIPTION
@ -47,12 +48,19 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
- http://www.consul.io/docs/agent/watches.html
:strong:`cdist-type__consul_agent`\ (7)
consul documentation at: <http://www.consul.io/docs/agent/watches.html>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul_watch_key(7)
===============================
Manages consul key watches
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_watch_key - Manages consul key watches
DESCRIPTION
@ -44,12 +45,19 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
- http://www.consul.io/docs/agent/watches.html
:strong:`cdist-type__consul_agent`\ (7)
consul documentation at: <http://www.consul.io/docs/agent/watches.html>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul_watch_keyprefix(7)
=====================================
Manages consul keyprefix watches
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_watch_keyprefix - Manages consul keyprefix watches
DESCRIPTION
@ -44,12 +45,19 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
- http://www.consul.io/docs/agent/watches.html
:strong:`cdist-type__consul_agent`\ (7)
consul documentation at: <http://www.consul.io/docs/agent/watches.html>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul_watch_nodes(7)
=================================
Manages consul nodes watches
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_watch_nodes - Manages consul nodes watches
DESCRIPTION
@ -40,12 +41,19 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
- http://www.consul.io/docs/agent/watches.html
:strong:`cdist-type__consul_agent`\ (7)
consul documentation at: <http://www.consul.io/docs/agent/watches.html>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul_watch_service(7)
===================================
Manages consul service watches
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_watch_service - Manages consul service watches
DESCRIPTION
@ -64,12 +65,19 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
- http://www.consul.io/docs/agent/watches.html
:strong:`cdist-type__consul_agent`\ (7)
consul documentation at: <http://www.consul.io/docs/agent/watches.html>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__consul_watch_services(7)
====================================
Manages consul services watches
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__consul_watch_services - Manages consul services watches
DESCRIPTION
@ -40,12 +41,19 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__consul_agent(7) <cdist-type__consul_agent.html>`_
- http://www.consul.io/docs/agent/watches.html
:strong:`cdist-type__consul_agent`\ (7)
consul documentation at: <http://www.consul.io/docs/agent/watches.html>.
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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

@ -1,8 +1,9 @@
cdist-type__cron(7)
===================
Installs and manages cron jobs
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__cron - Installs and manages cron jobs
DESCRIPTION
@ -67,11 +68,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- crontab(5)
:strong:`crontab`\ (5)
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011-2013 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-2013 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

@ -1,8 +1,9 @@
cdist-type__debconf_set_selections(7)
=====================================
Setup debconf selections
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__debconf_set_selections - Setup debconf selections
DESCRIPTION
@ -36,12 +37,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__update_alternatives(7) <cdist-type__update_alternatives.html>`_
- debconf-set-selections(1)
:strong:`debconf-set-selections`\ (1), :strong:`cdist-type__update_alternatives`\ (7)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2011-2014 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-2014 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.

View file

@ -1,8 +1,9 @@
cdist-type__directory(7)
========================
Manage a directory
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__directory - Manage a directory
DESCRIPTION
@ -87,12 +88,14 @@ EXAMPLES
--owner root --group root --mode 0755 --state present
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011 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.

View file

@ -1,8 +1,9 @@
cdist-type__dog_vdi(7)
======================
Manage Sheepdog VM images
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__dog_vdi - Manage Sheepdog VM images
DESCRIPTION
@ -42,12 +43,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- dog(8)
- qemu(1)
:strong:`qemu`\ (1), :strong:`dog`\ (8)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2014 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2014 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.

View file

@ -1,8 +1,9 @@
cdist-type__file(7)
===================
Manage files.
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__file - Manage files.
DESCRIPTION
@ -98,12 +99,14 @@ EXAMPLES
DONE
SEE ALSO
--------
* `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-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.

View file

@ -0,0 +1,43 @@
#!/bin/sh
#
# 2016 - 2016 Daniel Heule (hda at sfs.biz)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
os=$("$__explorer/os")
if [ -f "$__object/parameter/device" ]; then
blkdev="$(cat "$__object/parameter/device")"
else
blkdev="$__object_id"
fi
case "$os" in
centos|fedora|redhat|suse|gentoo)
if [ ! -x "$(command -v lsblk)" ]; then
echo "lsblk is required for __filesystem type" >&2
exit 1
else
#echo -n $(lsblk -nd -P -o NAME,FSTYPE,LABEL,MOUNTPOINT "$blkdev" 2>/dev/null)
lsblk -nd -P -o NAME,FSTYPE,LABEL,MOUNTPOINT "$blkdev" 2>/dev/null
fi
;;
*)
echo "__filesystem type lacks implementation for os: $os" >&2
exit 1
;;
esac

View file

@ -0,0 +1,102 @@
#!/bin/sh
#
# 2016 - 2016 Daniel Heule (hda at sfs.biz)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
fstype="$(cat "$__object/parameter/fstype")"
if [ -f "$__object/parameter/device" ]; then
mydev="$(cat "$__object/parameter/device")"
else
mydev="$__object_id"
fi
label="$(cat "$__object/parameter/label")"
mkfsoptions="$(cat "$__object/parameter/mkfsoptions")"
if [ -f "$__object/parameter/force" ]; then
# create filesystem even an other filesystem is on disk or the label is not correct, use with caution !
forcefs="true"
else
forcefs="false"
fi
blkdev_devname="$(grep -P -o 'NAME="\K[^"]*' "$__object/explorer/lsblk")"
blkdev_fstype="$(grep -P -o 'FSTYPE="\K[^"]*' "$__object/explorer/lsblk")"
blkdev_label="$(grep -P -o 'LABEL="\K[^"]*' "$__object/explorer/lsblk")"
blkdev_mountpoint="$(grep -P -o 'MOUNTPOINT="\K[^"]*' "$__object/explorer/lsblk")"
if [ -z "$blkdev_devname" ]; then
echo "Specified device $mydev not found on target system" >&2
exit 1
fi
[ "$blkdev_label" = "$label" ] && [ "$blkdev_fstype" = "$fstype" ] && exit 0
if [ -n "$blkdev_mountpoint" ]; then
echo "Specified device $mydev is mounted on $blkdev_mountpoint, __filesystem does NOTHING with mountd devices" >&2
exit 0
fi
if [ -n "$blkdev_fstype" ] && [ "$forcefs" != "true" ]; then
if [ "$blkdev_label" != "$label" ]; then
echo "Specified device $mydev has not the spezified label: $blkdev_label, but __filesystem does NOTHING in this case without the --force option" >&2
exit 0
fi
if [ "$blkdev_fstype" != "$fstype" ]; then
echo "Specified device $mydev has not the spezified filesystem: $blkdev_fstype, but __filesystem does NOTHING in this case without the --force option" >&2
exit 0
fi
fi
# ok, all conditions checked, we need to format the device, lets go
opts="$mkfsoptions"
if [ -n "$label" ]; then
opts="$opts -L '$label'"
fi
case "$fstype" in
ext2|ext3|ext4)
if [ "$forcefs" = "true" ]; then
opts="$opts -F"
fi
echo "mkfs.$fstype $opts /dev/$blkdev_devname"
;;
btrfs)
if [ "$forcefs" = "true" ]; then
opts="$opts --force"
fi
echo "mkfs.btrfs $opts /dev/$blkdev_devname"
;;
xfs)
if [ "$forcefs" = "true" ]; then
opts="$opts -f"
fi
echo "mkfs.xfs $opts /dev/$blkdev_devname"
;;
*)
echo "__filesystem type lacks implementation for filesystem: $fstype" >&2
exit 1
;;
esac
echo "filesystem $fstype on $mydev : /dev/$blkdev_devname created" >> "$__messages_out"

View file

@ -0,0 +1,81 @@
cdist-type__filesystem(7)
=========================
NAME
----
cdist-type__filesystem - Create Filesystems.
DESCRIPTION
-----------
This cdist type allows you to create filesystems on devices.
If the device is mounted on target, it refuses to do anything.
If the device has a filesystem other then the specified and/or
the label is not correct, it only makes a new filesystem
if you have specified --force option.
REQUIRED PARAMETERS
-------------------
fstype
Filesystem type, for example 'ext3', 'btrfs' or 'xfs'.
OPTIONAL PARAMETERS
-------------------
device
Blockdevice for filesystem, Defaults to object_id.
On linux, it can be any lsblk accepted device notation.
|
| For example:
| /dev/sdx
| or /dev/disk/by-xxxx/xxx
| or /dev/mapper/xxxx
label
Label which should be applied on the filesystem.
mkfsoptions
Additional options which are inserted to the mkfs.xxx call.
BOOLEAN PARAMETERS
------------------
force
Normally, this type does nothing if a filesystem is found
on the target device. If you specify force, it's formatted
if the filesystem type or label differs from parameters.
Warning: This option can easily lead into data loss!
MESSAGES
--------
filesystem <fstype> on <device> \: <discoverd device> created
Filesystem was created on <discoverd device>
EXAMPLES
--------
.. code-block:: sh
# Ensures that device /dev/sdb is formatted with xfs
__filesystem /dev/sdb --fstype xfs --label Testdisk1
# The same thing with btrfs and disk spezified by pci path to disk 1:0 on vmware
__filesystem dev_sdb --fstype btrfs --device /dev/disk/by-path/pci-0000:0b:00.0-scsi-0:0:0:0 --label Testdisk2
# Make sure that a multipath san device has a filesystem ...
__filesystem dev_sdb --fstype xfs --device /dev/mapper/360060e80432f560050202f22000023ff --label Testdisk3
AUTHORS
-------
Daniel Heule <hda--@--sfs.biz>
COPYING
-------
Copyright \(C) 2016 Daniel Heule. Free use of this software is
granted under the terms of the GNU General Public License version 3 or any later version (GPLv3+).

View file

@ -0,0 +1 @@
force

View file

@ -0,0 +1,3 @@
device
label
mkfsoptions

View file

@ -0,0 +1 @@
fstype

View file

@ -1,8 +1,9 @@
cdist-type__firewalld_rule(7)
=============================
Configure firewalld rules
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__firewalld_rule - Configure firewalld rules
DESCRIPTION
@ -64,12 +65,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__iptables_rule(7) <cdist-type__iptables_rule.html>`_
- firewalld(8)
:strong:`cdist-type__iptables_rule`\ (7), :strong:`firewalld`\ (8)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2015 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2015 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.

View file

@ -0,0 +1,84 @@
#!/bin/sh
#
# 2016 Darko Poljak(darko.poljak at ungleich.ch)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
startstate="$(cat "$__object/parameter/startstate")"
init=$(cat "$__global/explorer/init")
os=$(cat "$__global/explorer/os")
os_version=$(cat "$__global/explorer/os_version")
name="firewalld"
case "${startstate}" in
present)
cmd="start"
;;
absent)
cmd="stop"
;;
*)
echo "Unknown startstate: ${startstate}" >&2
exit 1
;;
esac
if [ "$init" = 'systemd' ]; then
# this handles ALL linux distros with systemd
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
echo "systemctl \"$cmd\" \"$name\""
else
case "$os" in
debian)
case "$os_version" in
[1-7]*)
echo "service \"$name\" \"$cmd\""
;;
8*)
echo "systemctl \"$cmd\" \"$name\""
;;
*)
echo "Unsupported version $os_version of $os" >&2
exit 1
;;
esac
;;
gentoo)
echo service \"$name\" \"$cmd\"
;;
amazon|scientific|centos|fedora|owl|redhat|suse)
echo service \"$name\" \"$cmd\"
;;
openwrt)
echo "/etc/init.d/\"$name\" \"$cmd\""
;;
ubuntu)
echo "service \"$name\" \"$cmd\""
;;
*)
echo "Unsupported os: $os" >&2
exit 1
;;
esac
fi

View file

@ -0,0 +1,53 @@
cdist-type__firewalld_start(7)
=============================
NAME
----
cdist-type__firewalld_start - start and enable firewalld
DESCRIPTION
-----------
This cdist type allows you to start and enable firewalld.
REQUIRED PARAMETERS
-------------------
None
OPTIONAL PARAMETERS
-------------------
startstate
'present' or 'absent', start/stop firewalld. Default is 'present'.
bootstate
'present' or 'absent', enable/disable firewalld on boot. Default is 'present'.
EXAMPLES
--------
.. code-block:: sh
# start and enable firewalld
__firewalld_start
# only enable firewalld to start on boot
__firewalld_start --startstate present --bootstate absent
SEE ALSO
--------
:strong:`firewalld`\ (8)
AUTHORS
-------
Darko Poljak <darko.poljak--@--ungleich.ch>
COPYING
-------
Copyright \(C) 2016 Darko Poljak. 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,23 @@
#!/bin/sh
#
# 2016 Darko Poljak (darko.poljak at ungleich.ch)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
bootstate="$(cat "$__object/parameter/bootstate")"
__package firewalld
require="__package/firewalld" __start_on_boot firewalld --state "${bootstate}"

View file

@ -0,0 +1 @@
present

View file

@ -0,0 +1 @@
present

View file

@ -0,0 +1,2 @@
bootstate
startstate

View file

@ -1,8 +1,9 @@
cdist-type__git(7)
==================
Get and or keep git repositories up-to-date
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__git - Get and or keep git repositories up-to-date
DESCRIPTION
@ -46,12 +47,14 @@ EXAMPLES
__git /home/nico/cdist --source git://github.com/telmich/cdist.git --branch 2.1
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2012 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2012 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.

View file

@ -1,8 +1,9 @@
cdist-type__group(7)
====================
Manage groups
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__group - Manage groups
DESCRIPTION
@ -66,12 +67,14 @@ EXAMPLES
__group foobar --gid 1234 --password 'crypted-password-string'
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011-2015 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-2015 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

@ -40,7 +40,7 @@ case "$os" in
exit 0
fi
;;
centos)
scientific|centos|openbsd)
if [ "$name_sysconfig" = "$name_should" -a "$name_running" = "$name_should" ]; then
exit 0
fi
@ -64,7 +64,7 @@ else
echo "hostname '$name_should'"
echo "printf '%s\n' '$name_should' > /etc/hostname"
;;
centos)
centos|openbsd)
echo "hostname '$name_should'"
;;
suse)

View file

@ -1,8 +1,9 @@
cdist-type__hostname(7)
=======================
Set the hostname
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__hostname - Set the hostname
DESCRIPTION
@ -38,12 +39,14 @@ EXAMPLES
__hostname --name some-static-hostname
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2012 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2012 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

@ -23,7 +23,14 @@ os=$(cat "$__global/explorer/os")
if [ -f "$__object/parameter/name" ]; then
name_should="$(cat "$__object/parameter/name")"
else
name_should="$(echo "${__target_host%%.*}")"
case "$os" in
openbsd)
name_should="$(echo "${__target_host}")"
;;
*)
name_should="$(echo "${__target_host%%.*}")"
;;
esac
fi
@ -38,13 +45,16 @@ case "$os" in
# handled in gencode-remote
:
;;
centos)
scientific|centos)
__key_value sysconfig-hostname \
--file /etc/sysconfig/network \
--delimiter '=' \
--key HOSTNAME \
--value "$name_should" --exact_delimiter
;;
openbsd)
echo "$name_should" | __file /etc/myname --source -
;;
*)
not_supported
;;

View file

@ -1,8 +1,9 @@
cdist-type__iptables_apply(7)
=============================
Apply the rules
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__iptables_apply - Apply the rules
DESCRIPTION
@ -28,12 +29,17 @@ None (__iptables_apply is used by __iptables_rule)
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__iptables_rule(7) <cdist-type__iptables_rule.html>`_
- iptables(8)
:strong:`cdist-type__iptables_rule`\ (7), :strong:`iptables`\ (8)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2013 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 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.

View file

@ -1,8 +1,9 @@
cdist-type__iptables_rule(7)
============================
Deploy iptable rulesets
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__iptables_rule - Deploy iptable rulesets
DESCRIPTION
@ -49,12 +50,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- `cdist-type__iptables_apply(7) <cdist-type__iptables_apply.html>`_
- iptables(8)
:strong:`cdist-type__iptables_apply`\ (7), :strong:`iptables`\ (8)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2013 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 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.

View file

@ -1,8 +1,9 @@
cdist-type__issue(7)
====================
Manage issue
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__issue - Manage issue
DESCRIPTION
@ -33,12 +34,14 @@ EXAMPLES
__issue --source "$__type/files/myfancyissue"
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011 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.

View file

@ -1,13 +1,14 @@
cdist-type__jail(7)
===================
Manage FreeBSD jails
Jake Guffey <jake.guffey--@--eprotex.com>
NAME
----
cdist-type__jail - Manage FreeBSD jails
DESCRIPTION
-----------
This type is used on FreeBSD to manage jails.
This type is used on FreeBSD to manage jails by calling the appropriate per-version subtype.
REQUIRED PARAMETERS
@ -107,10 +108,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
:strong:`jail`\ (8)
AUTHORS
-------
Jake Guffey <jake.guffey--@--jointheirstm.org>
COPYING
-------
Copyright \(C) 2012 Jake Guffey. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2012,2016 Jake Guffey. 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

@ -37,6 +37,19 @@ jaildir="$(cat "$__object/parameter/jaildir")"
__directory ${jaildir} --parents
set -- "$@" "$__object_id" "--state" "$state"
cd "$__object/parameter"
for property in $(ls .); do
set -- "$@" "--$property" "$(cat "$property")"
done
ver="$(cat "$__global/explorer/os_version")"
if [ -n "$(echo "$ver" | grep '^10\.' )" ]; then # Version is 10.x
__jail_freebsd10 "$@"
else
__jail_freebsd9 "$@"
fi
# Debug
#set +x

View file

@ -0,0 +1,52 @@
#!/bin/sh
#
# 2012 Jake Guffey (jake.guffey at eprotex.com)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# The __jail type creates, configures, and deletes FreeBSD jails for use as
# virtual machines.
#
# Debug
#exec >&2
#set -x
jaildir="$(cat "$__object/parameter/jaildir")"
jailbase="$(cat "$__object/parameter/jailbase")"
state="$(cat "$__object/parameter/state")"
if [ "$state" = "present" ] && [ -z "$jailbase" ]; then
exec >&2
echo "jailbase is a REQUIRED parameter when state=present!"
exit 1
fi
remotebase="${jaildir}/jailbase.tgz"
basepresent="$(cat "$__object/explorer/basepresent")"
if [ "$state" = "present" ]; then
if [ "$basepresent" = "NONE" ]; then
echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}"
fi # basepresent=NONE
fi # state=present
# Debug
#set +x

View file

@ -0,0 +1,362 @@
#!/bin/sh
#
# 2012,2014,2016 Jake Guffey (jake.guffey at jointheirstm.org)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# The __jail_freebsd10 type creates, configures, and deletes FreeBSD
# jails for use as virtual machines on FreeBSD 10.x.
#
# Debug
#exec >&2
#set -x
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
state="$(cat "$__object/parameter/state")"
started="true"
# If the user wants the jail gone, it implies it shouldn't be started.
[ -f "$__object/parameter/stopped" -o "$state" = "absent" ] && started="false"
if [ -f "$__object/parameter/ip" ]; then
ip="$(cat "$__object/parameter/ip")"
else
# IP is an optional param when $state=absent, but
# when $state=present, it's required. Enforce this.
if [ "$state" = "present" ]; then
exec >&2
echo "If --state is 'present,' --ip must be given\!"
exit 1
fi
fi
if [ -f "$__object/parameter/hostname" ]; then
hostname="$(cat "$__object/parameter/hostname")"
else
hostname="$name"
fi
if [ -f "$__object/parameter/devfs-disable" ]; then
devfsenable="false"
else
devfsenable="true"
fi
devfsruleset="$(cat "$__object/parameter/devfs-ruleset")"
# devfs_ruleset being defined without devfs_enable being true
# is pointless. Treat this as an error.
if [ -n "$devfsruleset" -a "$devfsenable" = "false" ]; then
exec >&2
echo "Can't have --devfs-ruleset defined with --devfs-disable"
exit 1
fi
if [ -f "$__object/parameter/onboot" ]; then
onboot="true"
fi
jaildir="$(cat "$__object/parameter/jaildir")"
present="$(cat "$__object/explorer/present")"
#present="$(cat "$__type/explorer/present")"
status="$(cat "$__object/explorer/status")"
# Handle ip="addr, addr" format
if [ $(expr "${ip}" : ".*, .*") -gt "0" ]; then
SAVE_IFS="$IFS"
IFS=", "
for cur_ip in ${ip}; do
# Just get the last IP address for SSH to listen on
mgmt_ip=$(echo "${ip}" | cut '-d ' -f1) # In case using "ip netmask" format rather than CIDR
done
IFS="$SAVE_IFS"
else
mgmt_ip=$(echo "${ip}" | cut '-d ' -f1) # In case using "ip netmask" format rather than CIDR
fi
stopJail() {
# Check $status before issuing command
if [ "$status" = "STARTED" ]; then
echo "/etc/rc.d/jail stop ${name}"
echo "stop" >> "$__messages_out"
fi
}
startJail() {
# Check $status before issuing command
if [ "$status" = "NOTSTART" ]; then
echo "/etc/rc.d/jail start ${name}"
echo "start" >> "$__messages_out"
fi
}
deleteJail() {
# Unmount the jail's mountpoints if necessary
cat <<EOF
output="\$(mount | grep "\/${name}\/dev")" || true
if [ -n "\${output}" ]; then # /dev is still mounted...jail still running?
/etc/rc.d/jail stop "${name}"
fi
output="\$(mount | grep "\/rw\/${name}\/")" || true
if [ -n "\${output}" ]; then # >=1 rw mount is mounted still
for DIR in "${output}"; do
umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print $3}')"
done
fi
output="\$(mount | grep "\/${name} (")" || true
if [ -n "\${output}" ]; then # ro mount is mounted still
umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print $3}')"
fi
EOF
# Remove the jail's rw mountpoints
echo "rm -rf \"${jaildir}/rw/${name}\""
# Remove the jail directory
echo "rm -rf \"${jaildir}/${name}\""
# Remove the jail's fstab
echo "rm -f \"/etc/fstab.${name}\""
# Remove jail entry from jail.conf
cat <<EOF
sed -i .bak -E -e "/^${name} {\$/,/^}\\\$/d" /etc/jail.conf
if [ -f "/etc/jail.conf.bak" ]; then
rm -f "/etc/jail.conf.bak"
fi
EOF
# Remove " $name " from jail_list if it's there
cat <<EOF
eval \$(grep '^jail_list=' /etc/rc.conf)
for JAIL in \${jail_list}; do
if [ ! "\${JAIL}" = "${name}" ]; then
new_list="\${new_list} \${JAIL}"
fi
done
jail_list="\${new_list}"
sed -i '.bak' "s/^jail_list=\".*\"/jail_list=\"\${jail_list}\"/" /etc/rc.conf
unset jail_list
if [ -f "/etc/rc.conf.bak" ]; then
rm -f /etc/rc.conf.bak
fi
EOF
echo "delete" >> "$__messages_out"
}
createJail() {
# Create the jail directory
cat <<EOF
umask 022
mkdir -p ${jaildir}/${name}
if [ ! -d "${jaildir}/base" ]; then
mkdir "${jaildir}/base"
tar -xzf "${jaildir}/jailbase.tgz" -C "${jaildir}/base"
if [ ! -d "${jaildir}/base/usr/local" ]; then
mkdir -p "${jaildir}/base/usr/local"
fi
if [ ! -d "${jaildir}/base/usr/home" ]; then
mkdir -p "${jaildir}/base/usr/home"
fi
if [ ! -d "${jaildir}/base/home" ]; then
if [ ! -L "${jaildir}/base/home" ]; then
SAVE=\$PWD; cd ${jaildir}/base
ln -s usr/home home
cd \$SAVE; unset SAVE
fi
fi
fi
if [ ! -d "${jaildir}/rw" ]; then
mkdir "${jaildir}/rw"
fi
mkdir -p "${jaildir}/rw/${name}/etc"
cp -r ${jaildir}/base/etc/* "${jaildir}/rw/${name}/etc/"
if [ ! -f "${jaildir}/rw/${name}/etc/resolv.conf" ]; then
cp /etc/resolv.conf "${jaildir}/rw/${name}/etc/"
fi
mkdir "${jaildir}/rw/${name}/local"
mkdir "${jaildir}/rw/${name}/var"
if [ -n "\$(ls ${jaildir}/base/var)" ]; then
cp -r ${jaildir}/base/var/* "${jaildir}/rw/${name}/var/"
fi
chmod 755 "${jaildir}/rw/${name}/var"
chmod 755 "${jaildir}/base/var"
if [ ! -d "${jaildir}/base/var/db" ]; then
mkdir -p "${jaildir}/base/var/db"
fi
if [ -n "\$(ls ${jaildir}/base/var/db)" ]; then
chmod 755 "${jaildir}/rw/${name}/var/db"
chmod 755 "${jaildir}/base/var/db"
fi
mkdir "${jaildir}/rw/${name}/home"
if [ -n "\$(ls ${jaildir}/base/usr/home)" ]; then
cp -r ${jaildir}/base/usr/home/* "${jaildir}/rw/${name}/home/"
fi
mkdir "${jaildir}/rw/${name}/root"
if [ -n "\$(ls -A ${jaildir}/base/root)" ]; then
cp -r ${jaildir}/base/root/ "${jaildir}/rw/${name}/root/"
fi
EOF
echo "create" >> "$__messages_out"
# Create the ro+rw mountpoint entries in fstab
cat <<EOF
cat >/etc/fstab.${name} <<END
${jaildir}/base ${jaildir}/${name} nullfs ro 0 0
${jaildir}/rw/${name}/etc ${jaildir}/${name}/etc nullfs rw 0 0
${jaildir}/rw/${name}/local ${jaildir}/${name}/usr/local nullfs rw 0 0
${jaildir}/rw/${name}/var ${jaildir}/${name}/var nullfs rw 0 0
${jaildir}/rw/${name}/home ${jaildir}/${name}/usr/home nullfs rw 0 0
${jaildir}/rw/${name}/root ${jaildir}/${name}/root nullfs rw 0 0
END
EOF
# Add the jail configuration to jail.conf
cat <<EOF
# first check to see whether jail_enable="YES" exists in rc.conf or not and add it
# if necessary
jail_enable="\$(grep '^jail_enable=' /etc/rc.conf | cut -d= -f2)"
if [ -z "\$jail_enable" ]; then # no jail_enable line in rc.conf at all
echo "jail_enable=\"YES\"" >>/etc/rc.conf
elif [ ! "\$(echo \$jail_enable | tr '[a-z]' '[A-Z]' | tr -d '"')" = "YES" ]; then # jail_enable="NO"
sed -i '.bak' 's/^jail_enable=.*$/jail_enable="YES"/g' /etc/rc.conf # fix this -^
rm -f /etc/rc.conf.bak
fi
jailfile=/etc/jail.conf
jailheader="${name} {"
jaildata="path=\"${jaildir}/${name}\";"
if [ "$devfsenable" = "true" ]; then
jaildata="\$jaildata
mount.devfs;"
else
jaildata="\$jaildata
mount.nodevfs;"
fi
jaildata="\$jaildata
host.hostname=\"${hostname}\";
ip4.addr=\"${ip}\";
exec.start=\"/bin/sh /etc/rc\";
exec.stop=\"/bin/sh /etc/rc.shutdown\";
exec.consolelog=\"/var/log/jail_${name}_console.log\";
mount.fstab=\"/etc/fstab.${name}\";
allow.mount;
exec.clean;
allow.set_hostname=0;
allow.sysvipc=0;
allow.raw_sockets=0;"
jailtrailer="}"
if [ "$devfsenable" = "true" ] && [ "${devfsruleset}" = "jailrules" ]; then # The default ruleset is to be used
if [ ! -f /etc/devfs.rules ]; then
touch /etc/devfs.rules
fi
if [ -z "\$(grep '\[jailrules=' /etc/devfs.rules)" ]; then # The default ruleset doesn't exist
# Get the highest-numbered ruleset
highest="\$(sed -n 's/\[.*=\([0-9]*\)\]/\1/pg' /etc/devfs.rules | sort -u | tail -n 1)" || true
# increment by 1
[ -z "\$highest" ] && highest=10
let num="\${highest}+1" 2>&1 >/dev/null # Close the FD==fail...
# add default ruleset
cat >>/etc/devfs.rules <<END
[jailrules=\${num}]
add include \\\$devfsrules_hide_all
add include \\\$devfsrules_unhide_basic
add include \\\$devfsrules_unhide_login
END
fi
devfsruleset_num=\$(grep "\[${devfsruleset}=" /etc/devfs.rules | sed -n 's/\[.*=\([0-9]*\)\]/\1/pg')
if [ -n "\$devfsruleset_num" ]; then
jaildata="\$jaildata
devfs_ruleset=\"\${devfsruleset_num}\";"
fi
fi
EOF
echo "printf \"%s\\n%s\n%s\n\" \"\$jailheader\" \"\$jaildata\" \"\$jailtrailer\" >>\"\$jailfile\""
# Add $name to jail_list if $onboot=yes
if [ "$onboot" = "yes" ]; then
# first check to see whether jail_enable="YES" exists in rc.conf or not and add it
# if necessary
cat <<EOF
eval "\$(grep '^jail_list=' /etc/rc.conf)"
if [ -z "\$jail_list" ]; then # no jail_list line in rc.conf at all
echo "jail_list=\"${name}\"" >>/etc/rc.conf
else
jail_list="\${jail_list} ${name}"
sed -i '.bak' "s/^jail_list=\".*\"/jail_list=\"\${jail_list}\"/" /etc/rc.conf
rm -f /etc/rc.conf.bak
fi
unset jail_list
EOF
echo "onboot" >> "$__messages_out"
fi
# Add the normal entries into the jail's rc.conf
cat <<EOF
echo hostname=\"${hostname}\" >"${jaildir}/rw/${name}/etc/rc.conf"
echo sshd_enable=\"YES\" >>"${jaildir}/rw/${name}/etc/rc.conf"
echo sendmail_enable=\"NONE\" >>"${jaildir}/rw/${name}/etc/rc.conf"
echo syslogd_enable=\"YES\" >>"${jaildir}/rw/${name}/etc/rc.conf"
echo syslogd_flags=\"-ss\" >>"${jaildir}/rw/${name}/etc/rc.conf"
EOF
# Configure SSHd's listening address
cat <<EOF
mgmt_ip="$(echo "$mgmt_ip" | sed -E -e 's#/[0-9]*$##g')"
sed -E -i '.bak' -e "s/#?ListenAddress 0.0.0.0/ListenAddress \${mgmt_ip}/" "${jaildir}/rw/${name}/etc/ssh/sshd_config"
EOF
}
if [ "$present" = "EXISTS" ]; then # The jail currently exists
if [ "$state" = "present" ]; then # The jail is supposed to exist
if [ "$started" = "true" ]; then # The jail is supposed to be started
startJail
else # The jail is not supposed to be started
stopJail
fi
exit 0
else # The jail is not supposed to exist
stopJail
deleteJail
exit 0
fi
else # The jail does not currently exist
if [ "$state" = "absent" ]; then # The jail is not supposed to be present
exit 0
else # The jail is supposed to exist
createJail
[ "$started" = "true" ] && startJail
exit 0
fi
fi

View file

@ -0,0 +1,123 @@
cdist-type__jail_freebsd10(7)
=============================
NAME
----
cdist-type__jail_freeebsd10 - Manage FreeBSD jails
DESCRIPTION
-----------
This type is used on FreeBSD >= 10.0 to manage jails.
REQUIRED PARAMETERS
-------------------
state
Either "present" or "absent", defaults to "present".
jailbase
The location of the .tgz archive containing the base fs for your jails.
OPTIONAL PARAMETERS
-------------------
name
The name of the jail. Default is to use the object_id as the jail name.
ip
The ifconfig style IP/netmask combination to use for the jail guest. If
the state parameter is "present," this parameter is required.
hostname
The FQDN to use for the jail guest. Defaults to the name parameter.
interface
The name of the physical interface on the jail server to bind the jail to.
Defaults to the first interface found in the output of ifconfig -l.
devfs-ruleset
The name of the devfs ruleset to associate with the jail. Defaults to
"jailrules." This ruleset must be copied to the server via another type.
To use this option, devfs-enable must be "true."
jaildir
The location on the remote server to use for hosting jail filesystems.
Defaults to /usr/jail.
BOOLEAN PARAMETERS
------------------
stopped
Do not start the jail
devfs-disable
Whether to disallow devfs mounting within the jail
onboot
Whether to add the jail to rc.conf's jail_list variable.
CAVEATS
-------
This type does not currently support modification of jail options. If, for
example a jail needs to have its IP address or netmask changed, the jail must
be removed then re-added with the correct IP address/netmask or the appropriate
modifications to jail.conf need to be made through alternate means.
MESSAGES
--------
start
The jail was started
stop
The jail was stopped
create:
The jail was created
delete
The jail was deleted
onboot
The jail was configured to start on boot
EXAMPLES
--------
.. code-block:: sh
# Create a jail called www
__jail_freebsd10 www --state present --ip "192.168.1.2" --jailbase /my/jail/base.tgz
# Remove the jail called www
__jail_freebsd10 www --state absent --jailbase /my/jail/base.tgz
# The jail www should not be started
__jail_freebsd10 www --state present --stopped \
--ip "192.168.1.2 netmask 255.255.255.0" \
--jailbase /my/jail/base.tgz
# Use the name variable explicitly
__jail_freebsd10 thisjail --state present --name www \
--ip "192.168.1.2" \
--jailbase /my/jail/base.tgz
# Go nuts
__jail_freebsd10 lotsofoptions --state present --name testjail \
--ip "192.168.1.100 netmask 255.255.255.0" \
--hostname "testjail.example.com" --interface "em0" \
--onboot --jailbase /my/jail/base.tgz --jaildir /jails
SEE ALSO
--------
:strong:`jail`\ (8)
AUTHORS
-------
Jake Guffey <jake.guffey--@--jointheirstm.org>
COPYING
-------
Copyright \(C) 2012-2016 Jake Guffey. 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,3 @@
onboot
stopped
devfs-disable

View file

@ -0,0 +1 @@
jailrules

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@
/usr/jail

View file

@ -0,0 +1 @@
present

View file

@ -0,0 +1,8 @@
name
ip
hostname
interface
devfs-ruleset
jaildir
jailbase
state

View file

@ -0,0 +1,54 @@
#!/bin/sh
#
# 2012 Jake Guffey (jake.guffey at eprotex.com)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# See if the jailbase.tgz or $jaildir/base dir exists
#
# Debug
#exec >&2
#set -x
if [ -f "$__object/parameter/jaildir" ]; then
jaildir="$(cat "$__object/parameter/jaildir")"
else
jaildir="/usr/jail"
fi
name="base:jailbase.tgz"
out=""
save_IFS="$IFS"
IFS=":"
for cur in $name; do
if [ -e "${jaildir}/$cur" ]; then
out="${out}:${cur}"
fi
done
IFS="$save_IFS"
if [ -z "$out" ]; then
echo "NONE"
else
echo "${out}"
fi
# Debug
#set +x

View file

@ -0,0 +1,43 @@
#!/bin/sh
#
# 2012 Jake Guffey (jake.guffey at eprotex.com)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# See if the requested jail exists
#
# Debug
#exec >&2
#set -x
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name=$__object_id
fi
if [ -f "$__object/parameter/jaildir" ]; then
jaildir="$(cat "$__object/parameter/jaildir")"
else
jaildir="/usr/jail"
fi
[ -d "${jaildir}/$name" ] && echo "EXISTS" || echo "NOTEXIST"
#set +x

View file

@ -0,0 +1,52 @@
#!/bin/sh
#
# 2012 Jake Guffey (jake.guffey at eprotex.com)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# See if the requested jail is started
#
# Debug
#exec >&2
#set -x
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
if [ -f "$__object/parameter/jaildir" ]; then
jaildir="$(cat "$__object/parameter/jaildir")"
else
jaildir="/usr/jail"
fi
# backslash-escaped $jaildir
sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')"
jls_output="$(jls | grep "[ ]${sjaildir}\/${name}\$")" || true
if [ -n "${jls_output}" ]; then
echo "STARTED"
else
echo "NOTSTART"
fi
# Debug
#set +x

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# 2012,2014 Jake Guffey (jake.guffey at eprotex.com)
# 2012,2014,2016 Jake Guffey (jake.guffey at jointheirstm.org)
#
# This file is part of cdist.
#
@ -18,8 +18,8 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# The __jail type creates, configures, and deletes FreeBSD jails for use as
# virtual machines.
# The __jail_freebsd9 type creates, configures, and deletes FreeBSD jails
# for use as virtual machines on FreeBSD 9.x and before.
#
# Debug
@ -354,3 +354,4 @@ else # The jail does not currently exist
exit 0
fi
fi

View file

@ -0,0 +1,124 @@
cdist-type__jail_freebsd9(7)
============================
NAME
----
cdist-type__jail_freebsd9 - Manage FreeBSD jails
DESCRIPTION
-----------
This type is used on FreeBSD <= 9.x to manage jails.
REQUIRED PARAMETERS
-------------------
state
Either "present" or "absent", defaults to "present".
jailbase
The location of the .tgz archive containing the base fs for your jails.
OPTIONAL PARAMETERS
-------------------
name
The name of the jail. Default is to use the object_id as the jail name.
ip
The ifconfig style IP/netmask combination to use for the jail guest. If
the state parameter is "present," this parameter is required.
hostname
The FQDN to use for the jail guest. Defaults to the name parameter.
interface
The name of the physical interface on the jail server to bind the jail to.
Defaults to the first interface found in the output of ifconfig -l.
devfs-ruleset
The name of the devfs ruleset to associate with the jail. Defaults to
"jailrules." This ruleset must be copied to the server via another type.
To use this option, devfs-enable must be "true."
jaildir
The location on the remote server to use for hosting jail filesystems.
Defaults to /usr/jail.
BOOLEAN PARAMETERS
------------------
stopped
Do not start the jail
devfs-disable
Whether to disallow devfs mounting within the jail
onboot
Whether to add the jail to rc.conf's jail_list variable.
CAVEATS
-------
This type does not currently support modification of jail options. If, for
example a jail needs to have its IP address or netmask changed, the jail must
be removed then re-added with the correct IP address/netmask or the appropriate
line (jail_<name>_ip="...") modified within rc.conf through some alternate
means.
MESSAGES
--------
start
The jail was started
stop
The jail was stopped
create:
The jail was created
delete
The jail was deleted
onboot
The jail was configured to start on boot
EXAMPLES
--------
.. code-block:: sh
# Create a jail called www
__jail_freebsd9 www --state present --ip "192.168.1.2" --jailbase /my/jail/base.tgz
# Remove the jail called www
__jail_freebsd9 www --state absent --jailbase /my/jail/base.tgz
# The jail www should not be started
__jail_freebsd9 www --state present --stopped \
--ip "192.168.1.2 netmask 255.255.255.0" \
--jailbase /my/jail/base.tgz
# Use the name variable explicitly
__jail_freebsd9 thisjail --state present --name www \
--ip "192.168.1.2" \
--jailbase /my/jail/base.tgz
# Go nuts
__jail_freebsd9 lotsofoptions --state present --name testjail \
--ip "192.168.1.100 netmask 255.255.255.0" \
--hostname "testjail.example.com" --interface "em0" \
--onboot --jailbase /my/jail/base.tgz --jaildir /jails
SEE ALSO
--------
:strong:`jail`\ (8)
AUTHORS
-------
Jake Guffey <jake.guffey--@--eprotex.com>
COPYING
-------
Copyright \(C) 2012-2016 Jake Guffey. 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,3 @@
onboot
stopped
devfs-disable

View file

@ -0,0 +1 @@
jailrules

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@
/usr/jail

View file

@ -0,0 +1 @@
present

View file

@ -0,0 +1,8 @@
name
ip
hostname
interface
devfs-ruleset
jaildir
jailbase
state

View file

@ -1,8 +1,9 @@
cdist-type__key_value(7)
========================
Change property values in files
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__key_value - Change property values in files
DESCRIPTION
@ -71,21 +72,23 @@ EXAMPLES
--delimiter ' = ' --comment '# my linux kernel should act as a router'
# Remove existing key/value
__key_value LEGACY_KEY --file /etc/somefile --state absent --delimiter '='
__key_value LEGACY_KEY --file /etc/somefile --state absent --delimiter '='
MORE INFORMATION
----------------
This type try to handle as many values as possible, so it doesn't use regexes.
So you need to exactly specify the key and delimiter. Delimiter can be of any lenght.
So you need to exactly specify the key and delimiter. Delimiter can be of any length.
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Steven Armstrong <steven-cdist--@--armstrong.cc>
COPYING
-------
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011 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

@ -0,0 +1,37 @@
cdist-type__keyboard(7)
=======================
NAME
----
cdit-type__keyboard - Set keyboard layout
DESCRIPTION
-----------
This cdist type allows you to modify keyboard layout.
REQUIRED PARAMETERS
-------------------
type
Any valid type, for example "us"
EXAMPLES
--------
.. code-block:: sh
# Set keyboard type to "us"
__keyboard --type "us"
AUTHORS
-------
Carlos Ortigoza <carlos.ortigoza--@--ungleich.ch>
COPYING
-------
Copyright \(C) 2016 Carlos Ortigoza. Free use of this software is
granted under the terms of the GNU General Public License v3 or later (GPLv3+).

View file

@ -0,0 +1,50 @@
#!/bin/sh
#
# Carlos Ortigoza (carlos.ortigoza at ungleich.ch)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Configure keyboard type by modifying /etc/sysconfig/keyboard file.
#
os=$(cat "$__global/explorer/os")
keyboard_type="$(cat "$__object/parameter/type")"
case "$os" in
centos)
__file /etc/sysconfig/keyboard \
--owner root --group root --mode 644 \
--state exists
require="__file/etc/sysconfig/keyboard" \
__key_value KEYTABLE \
--file /etc/sysconfig/keyboard \
--delimiter '=' \
--value "\"$keyboard_type\""
require="__file/etc/sysconfig/keyboard" \
__key_value LAYOUT \
--file /etc/sysconfig/keyboard \
--delimiter '=' \
--value "\"$keyboard_type\""
;;
*)
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
echo "Please contribute an implementation for it if you can." >&2
exit 1
;;
esac

View file

@ -0,0 +1 @@
type

View file

View file

@ -1,8 +1,9 @@
cdist-type__line(7)
===================
Manage lines in files
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__line - Manage lines in files
DESCRIPTION
@ -60,11 +61,17 @@ EXAMPLES
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
- grep(1)
:strong:`grep`\ (1)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2012-2013 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
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.

View file

@ -1,8 +1,9 @@
cdist-type__link(7)
===================
Manage links (hard and symbolic)
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__link - Manage links (hard and symbolic)
DESCRIPTION
@ -46,12 +47,14 @@ EXAMPLES
__link /opt/plone --state absent
SEE ALSO
--------
- `cdist-type(7) <cdist-type.html>`_
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2011-2012 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.

View file

@ -1,8 +1,9 @@
cdist-type__locale(7)
=====================
Configure locales
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__locale - Configure locales
DESCRIPTION
@ -33,12 +34,16 @@ EXAMPLES
SEE ALSO
--------
- locale(1)
- localedef(1)
- `cdist-type(7) <cdist-type.html>`_
:strong:`locale`\ (1), :strong:`localedef`\ (1), :strong:`cdist-type__locale_system`\ (7)
AUTHORS
-------
Nico Schottelius <nico-cdist--@--schottelius.org>
COPYING
-------
Copyright \(C) 2013-2014 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
Copyright \(C) 2013-2016 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 or
later (GPLv3+).

View file

@ -30,7 +30,7 @@ case "$os" in
# Debian needs a seperate package
__package locales --state present
;;
archlinux|suse|ubuntu|centos)
archlinux|suse|ubuntu|scientific|centos)
:
;;
*)

View file

@ -0,0 +1,64 @@
cdist-type__locale_system(7)
============================
NAME
----
cdist-type__locale_system - Set system-wide locale
DESCRIPTION
-----------
This cdist type allows you to modify system-wide locale.
The name of the locale category is given as the object id
(usually you are probably interested in using LANG).
OPTIONAL PARAMETERS
-------------------
state
present or absent, defaults to present.
If present, sets the locale category to the given value.
If absent, removes the locale category from the system file.
value
The value for the locale category.
Defaults to en_US.UTF-8.
EXAMPLES
--------
.. code-block:: sh
# Set LANG to en_US.UTF-8
__locale_system LANG
# Same as above, but more explicit
__locale_system LANG --value en_US.UTF-8
# Set category LC_MESSAGES to de_CH.UTF-8
__locale_system LC_MESSAGES --value de_CH.UTF-8
# Remove setting for LC_ALL
__locale_system LC_ALL --state absent
SEE ALSO
--------
:strong:`locale`\ (1), :strong:`localedef`\ (1), :strong:`cdist-type__locale`\ (7)
AUTHORS
-------
| Steven Armstrong <steven-cdist--@--armstrong.cc>
| Carlos Ortigoza <carlos.ortigoza--@--ungleich.ch>
| Nico Schottelius <nico.schottelius--@--ungleich.ch>
COPYING
-------
Copyright \(C) 2016 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 or
later (GPLv3+).

View file

@ -0,0 +1,55 @@
#!/bin/sh
#
# 2012-2016 Steven Armstrong (steven-cdist at armstrong.cc)
# 2016 Carlos Ortigoza (carlos.ortigoza at ungleich.ch)
# 2016 Nico Schottelius (nico.schottelius at ungleich.ch)
#
# This file is part of cdist.
#
# cdist is free software: 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.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Configure system-wide locale by modifying i18n file.
#
os=$(cat "$__global/explorer/os")
case "$os" in
debian|ubuntu)
locale_conf="/etc/default/locale"
;;
archlinux)
locale_conf="/etc/locale.conf"
;;
redhat|centos)
locale_conf="/etc/sysconfig/i18n"
;;
*)
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
echo "Please contribute an implementation for it if you can." >&2
exit 1
;;
esac
__file "$locale_conf" \
--owner root --group root --mode 644 \
--state exists
require="__file/$locale_conf" \
__key_value "$locale_conf:$__object_id" \
--file "$locale_conf" \
--key "$__object_id" \
--delimiter = \
--state "$(cat "$__object/parameter/state")" \
--value "$(cat "$__object/parameter/value")"

View file

@ -0,0 +1 @@
present

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