Merge remote-tracking branch 'ungleich/master' into the-good-the-bad-and-the-ugly
This commit is contained in:
		
				commit
				
					
						e375bd464d
					
				
			
		
					 98 changed files with 1547 additions and 106 deletions
				
			
		| 
						 | 
					@ -85,9 +85,11 @@ def get_parsers():
 | 
				
			||||||
            action='store_true', default=False)
 | 
					            action='store_true', default=False)
 | 
				
			||||||
    parser['loglevel'].add_argument(
 | 
					    parser['loglevel'].add_argument(
 | 
				
			||||||
            '-v', '--verbose',
 | 
					            '-v', '--verbose',
 | 
				
			||||||
            help=('Increase log level, be more verbose. Use it more than once '
 | 
					            help=('Increase the verbosity level. Every instance of -v '
 | 
				
			||||||
                  'to increase log level. The order of levels from the lowest '
 | 
					                  'increments the verbosity level by one. Its default value '
 | 
				
			||||||
                  'to the highest are: ERROR, WARNING, INFO, DEBUG.'),
 | 
					                  'is 0. There are 4 levels of verbosity. The order of levels '
 | 
				
			||||||
 | 
					                  'from the lowest to the highest are: ERROR (0), '
 | 
				
			||||||
 | 
					                  'WARNING (1), INFO (2) and DEBUG (3 or higher).'),
 | 
				
			||||||
            action='count', default=0)
 | 
					            action='count', default=0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    parser['beta'] = argparse.ArgumentParser(add_help=False)
 | 
					    parser['beta'] = argparse.ArgumentParser(add_help=False)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/explorer/kernel_name
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/explorer/kernel_name
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					uname -s
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
cdist-type__install_chroot_mount(7)
 | 
					cdist-type__chroot_mount(7)
 | 
				
			||||||
===================================
 | 
					===================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
NAME
 | 
					NAME
 | 
				
			||||||
----
 | 
					----
 | 
				
			||||||
cdist-type__install_chroot_mount - mount a chroot
 | 
					cdist-type__chroot_mount - mount a chroot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DESCRIPTION
 | 
					DESCRIPTION
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@ EXAMPLES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block:: sh
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    __install_chroot_mount /path/to/chroot
 | 
					    __chroot_mount /path/to/chroot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUTHORS
 | 
					AUTHORS
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
cdist-type__install_chroot_umount(7)
 | 
					cdist-type__chroot_umount(7)
 | 
				
			||||||
====================================
 | 
					============================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
NAME
 | 
					NAME
 | 
				
			||||||
----
 | 
					----
 | 
				
			||||||
cdist-type__install_chroot_umount - unmount a chroot mounted by __chroot_mount
 | 
					cdist-type__chroot_umount - unmount a chroot mounted by __chroot_mount
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DESCRIPTION
 | 
					DESCRIPTION
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@ EXAMPLES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block:: sh
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    __install_chroot_umount /path/to/chroot
 | 
					    __chroot_umount /path/to/chroot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SEE ALSO
 | 
					SEE ALSO
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.8.1/cksum
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.8.1/cksum
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					283033689 36101209 consul
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.8.1/source
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.8.1/source
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					https://releases.hashicorp.com/consul/0.8.1/consul_0.8.1_linux_amd64.zip
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,7 @@
 | 
				
			||||||
os=$(cat "$__global/explorer/os")
 | 
					os=$(cat "$__global/explorer/os")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
   scientific|centos|redhat|ubuntu|debian|archlinux|gentoo)
 | 
					   scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo)
 | 
				
			||||||
      # any linux should work
 | 
					      # any linux should work
 | 
				
			||||||
      :
 | 
					      :
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,7 @@
 | 
				
			||||||
os=$(cat "$__global/explorer/os")
 | 
					os=$(cat "$__global/explorer/os")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
   scientific|centos|debian|redhat|ubuntu)
 | 
					   scientific|centos|debian|devuan|redhat|ubuntu)
 | 
				
			||||||
      # whitelist safeguard
 | 
					      # whitelist safeguard
 | 
				
			||||||
      :
 | 
					      :
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
| 
						 | 
					@ -215,6 +215,10 @@ case "$os" in
 | 
				
			||||||
        esac
 | 
					        esac
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    devuan)
 | 
				
			||||||
 | 
					        init_sysvinit debian
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ubuntu)
 | 
					    ubuntu)
 | 
				
			||||||
        init_upstart
 | 
					        init_upstart
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,6 +24,9 @@ OPTIONAL PARAMETERS
 | 
				
			||||||
check-interval
 | 
					check-interval
 | 
				
			||||||
   the interval in which the script given with --check-script should be run
 | 
					   the interval in which the script given with --check-script should be run
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					check-http
 | 
				
			||||||
 | 
					   the URL to check for HTTP 200-ish status every --check-interval
 | 
				
			||||||
 | 
					
 | 
				
			||||||
check-script
 | 
					check-script
 | 
				
			||||||
   the shell command to run every --check-interval
 | 
					   the shell command to run every --check-interval
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +32,10 @@ if [ -f "$__object/parameter/check-script" -a ! -f "$__object/parameter/check-in
 | 
				
			||||||
   echo "When using --check-script you must also define --check-interval" >&2
 | 
					   echo "When using --check-script you must also define --check-interval" >&2
 | 
				
			||||||
   exit 1
 | 
					   exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/check-http" -a ! -f "$__object/parameter/check-interval" ]; then
 | 
				
			||||||
 | 
					   echo "When using --check-http you must also define --check-interval" >&2
 | 
				
			||||||
 | 
					   exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generate json config file
 | 
					# Generate json config file
 | 
				
			||||||
(
 | 
					(
 | 
				
			||||||
| 
						 | 
					@ -52,6 +56,12 @@ for param in $(ls "$__object/parameter/"); do
 | 
				
			||||||
         printf '         "ttl": "%s"\n' "$(cat "$__object/parameter/check-ttl")"
 | 
					         printf '         "ttl": "%s"\n' "$(cat "$__object/parameter/check-ttl")"
 | 
				
			||||||
         printf '      }\n'
 | 
					         printf '      }\n'
 | 
				
			||||||
      ;;
 | 
					      ;;
 | 
				
			||||||
 | 
					      check-http)
 | 
				
			||||||
 | 
					         printf '     ,"check": {\n'
 | 
				
			||||||
 | 
					         printf '         "http": "%s"\n' "$(cat "$__object/parameter/check-http")"
 | 
				
			||||||
 | 
					         printf '         ,"interval": "%s"\n' "$(cat "$__object/parameter/check-interval")"
 | 
				
			||||||
 | 
					         printf '      }\n'
 | 
				
			||||||
 | 
					      ;;
 | 
				
			||||||
      tag)
 | 
					      tag)
 | 
				
			||||||
         # create json array from newline delimited file
 | 
					         # create json array from newline delimited file
 | 
				
			||||||
         tags="$(awk '{printf "\""$1"\","}' "$__object/parameter/tag")"
 | 
					         tags="$(awk '{printf "\""$1"\","}' "$__object/parameter/tag")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
 | 
					check-http
 | 
				
			||||||
check-interval
 | 
					check-interval
 | 
				
			||||||
check-script
 | 
					check-script
 | 
				
			||||||
check-ttl
 | 
					check-ttl
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,4 +22,9 @@
 | 
				
			||||||
name="$__object_name"
 | 
					name="$__object_name"
 | 
				
			||||||
user="$(cat "$__object/parameter/user")"
 | 
					user="$(cat "$__object/parameter/user")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
crontab -u $user -l 2>/dev/null | grep "# $name\$" || true
 | 
					if [ -f "$__object/parameter/raw_command" ]; then
 | 
				
			||||||
 | 
					    command="$(cat "$__object/parameter/command")"
 | 
				
			||||||
 | 
					    crontab -u $user -l 2>/dev/null | grep "^$command\$" || true
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    crontab -u $user -l 2>/dev/null | grep "# $name\$" || true
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										13
									
								
								cdist/conf/type/__cron/gencode-remote
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										13
									
								
								cdist/conf/type/__cron/gencode-remote
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
					@ -3,6 +3,7 @@
 | 
				
			||||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
					# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
				
			||||||
# 2013      Nico Schottelius (nico-cdist at schottelius.org)
 | 
					# 2013      Nico Schottelius (nico-cdist at schottelius.org)
 | 
				
			||||||
# 2013      Thomas Oettli (otho at sfs.biz)
 | 
					# 2013      Thomas Oettli (otho at sfs.biz)
 | 
				
			||||||
 | 
					# 2017      Daniel Heule (hda at sfs.biz)
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# This file is part of cdist.
 | 
					# This file is part of cdist.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					@ -26,7 +27,7 @@ command="$(cat "$__object/parameter/command")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -f "$__object/parameter/raw" ]; then
 | 
					if [ -f "$__object/parameter/raw" ]; then
 | 
				
			||||||
   raw="$(cat "$__object/parameter/raw")"
 | 
					   raw="$(cat "$__object/parameter/raw")"
 | 
				
			||||||
   entry="$raw $command"
 | 
					   entry="$raw $command # $name"
 | 
				
			||||||
elif [ -f "$__object/parameter/raw_command" ]; then
 | 
					elif [ -f "$__object/parameter/raw_command" ]; then
 | 
				
			||||||
   entry="$command"
 | 
					   entry="$command"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
| 
						 | 
					@ -35,10 +36,9 @@ else
 | 
				
			||||||
   day_of_month="$(cat "$__object/parameter/day_of_month" 2>/dev/null || echo "*")"
 | 
					   day_of_month="$(cat "$__object/parameter/day_of_month" 2>/dev/null || echo "*")"
 | 
				
			||||||
   month="$(cat "$__object/parameter/month" 2>/dev/null || echo "*")"
 | 
					   month="$(cat "$__object/parameter/month" 2>/dev/null || echo "*")"
 | 
				
			||||||
   day_of_week="$(cat "$__object/parameter/day_of_week" 2>/dev/null || echo "*")"
 | 
					   day_of_week="$(cat "$__object/parameter/day_of_week" 2>/dev/null || echo "*")"
 | 
				
			||||||
   entry="$minute $hour $day_of_month $month $day_of_week $command"
 | 
					   entry="$minute $hour $day_of_month $month $day_of_week $command # $name"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
entry="$entry # $name"
 | 
					 | 
				
			||||||
mkdir "$__object/files"
 | 
					mkdir "$__object/files"
 | 
				
			||||||
echo "$entry" > "$__object/files/entry"
 | 
					echo "$entry" > "$__object/files/entry"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,7 +58,7 @@ state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo "present")"
 | 
				
			||||||
# These are the old markers
 | 
					# These are the old markers
 | 
				
			||||||
prefix="#cdist:__cron/$__object_id"
 | 
					prefix="#cdist:__cron/$__object_id"
 | 
				
			||||||
suffix="#/cdist:__cron/$__object_id"
 | 
					suffix="#/cdist:__cron/$__object_id"
 | 
				
			||||||
filter="^# DO NOT EDIT THIS FILE|^# \(.* installed on |^# \(Cron version V"
 | 
					filter="^# DO NOT EDIT THIS FILE|^# \(.* installed on |^# \(Cron version V|^# \(Cronie version .\..\)$"
 | 
				
			||||||
cat << DONE
 | 
					cat << DONE
 | 
				
			||||||
crontab -u $user -l 2>/dev/null | grep -v -E "$filter" | awk -v prefix="$prefix" -v suffix="$suffix" '
 | 
					crontab -u $user -l 2>/dev/null | grep -v -E "$filter" | awk -v prefix="$prefix" -v suffix="$suffix" '
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -85,7 +85,12 @@ case "$state_should" in
 | 
				
			||||||
        echo ") | crontab -u $user -"
 | 
					        echo ") | crontab -u $user -"
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
    absent)
 | 
					    absent)
 | 
				
			||||||
 | 
					        if [ -f "$__object/parameter/raw_command" ]; then
 | 
				
			||||||
 | 
					            echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
 | 
				
			||||||
 | 
					            echo "grep -v \"^$entry\\$\" | crontab -u $user -"
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
            echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
 | 
					            echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
 | 
				
			||||||
            echo "grep -v \"# $name\\$\" | crontab -u $user -"
 | 
					            echo "grep -v \"# $name\\$\" | crontab -u $user -"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										63
									
								
								cdist/conf/type/__daemontools/files/init.d-svscan
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								cdist/conf/type/__daemontools/files/init.d-svscan
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,63 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					### BEGIN INIT INFO
 | 
				
			||||||
 | 
					# Provides:          svscan
 | 
				
			||||||
 | 
					# Required-Start:
 | 
				
			||||||
 | 
					# Required-Stop:
 | 
				
			||||||
 | 
					# Default-Start:     2 3 4 5
 | 
				
			||||||
 | 
					# Default-Stop:      0 1 6
 | 
				
			||||||
 | 
					# Short-Description: svscan
 | 
				
			||||||
 | 
					# Description:       djb svscan
 | 
				
			||||||
 | 
					### END INIT INFO
 | 
				
			||||||
 | 
					# from https://gist.githubusercontent.com/pacojp/5766990/raw/2ed009ab19515afc9e58291b636d673c5ca864b3/init.d.svscan
 | 
				
			||||||
 | 
					# written by Adam McKenna <adam@debian.org>
 | 
				
			||||||
 | 
					# edited by Kamila Součková <kamila@ksp.sk>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export PATH=$PATH:/usr/local/bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					l=/var/log/svscan
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! -d $l ]; then
 | 
				
			||||||
 | 
					  mkdir $l
 | 
				
			||||||
 | 
					  chown daemon $l
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					case "$1" in
 | 
				
			||||||
 | 
					    start)
 | 
				
			||||||
 | 
					        echo -n "Starting daemontools: "
 | 
				
			||||||
 | 
					        if [ ! `pidof svscan` ]; then
 | 
				
			||||||
 | 
					                echo -n "svscan "
 | 
				
			||||||
 | 
					                env - PATH="$PATH" svscan /service 2>&1 | setuidgid daemon multilog t /var/log/svscan &
 | 
				
			||||||
 | 
					                echo "."
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					                echo "already running."
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					    stop)
 | 
				
			||||||
 | 
					        echo -n "Stopping daemontools: "
 | 
				
			||||||
 | 
					        if [ `pidof svscan` ]; then
 | 
				
			||||||
 | 
					                echo -n "svscan"
 | 
				
			||||||
 | 
					                while [ `pidof svscan` ]; do
 | 
				
			||||||
 | 
					                     kill `pidof svscan`
 | 
				
			||||||
 | 
					                     echo -n "."
 | 
				
			||||||
 | 
					                done
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        echo -n " services"
 | 
				
			||||||
 | 
					        for i in `ls -d /service/*`; do
 | 
				
			||||||
 | 
					                svc -dx $i
 | 
				
			||||||
 | 
					                echo -n "."
 | 
				
			||||||
 | 
					        done
 | 
				
			||||||
 | 
					        echo -n " logging "
 | 
				
			||||||
 | 
					        for i in `ls -d /service/*/log`; do
 | 
				
			||||||
 | 
					                svc -dx $i
 | 
				
			||||||
 | 
					                echo -n "."
 | 
				
			||||||
 | 
					        done
 | 
				
			||||||
 | 
					        echo ""
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					    restart|force-reload)
 | 
				
			||||||
 | 
					        $0 stop
 | 
				
			||||||
 | 
					        $0 start
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					    *)
 | 
				
			||||||
 | 
					        echo 'Usage: /etc/init.d/svscan {start|stop|restart|force-reload}'
 | 
				
			||||||
 | 
					        exit 1
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
							
								
								
									
										49
									
								
								cdist/conf/type/__daemontools/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								cdist/conf/type/__daemontools/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,49 @@
 | 
				
			||||||
 | 
					cdist-type__daemontools(7)
 | 
				
			||||||
 | 
					==========================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__daemontools - Install daemontools
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					Install djb daemontools and (optionally) an init script.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					from-package
 | 
				
			||||||
 | 
					   Package to install. Must be compatible with the original daemontools. Example: daemontools-encore. Default: daemontools.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN PARAMETERS
 | 
				
			||||||
 | 
					------------------
 | 
				
			||||||
 | 
					install-init-script
 | 
				
			||||||
 | 
					   Add an init script and set it to start on boot. Default yes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __daemontools --from-package daemontools-encore  # if you prefer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					:strong:`cdist-type__daemontools_service`\ (7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
							
								
								
									
										20
									
								
								cdist/conf/type/__daemontools/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								cdist/conf/type/__daemontools/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,20 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pkg=$(cat "$__object/parameter/from-package")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__package $pkg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/install-init-script" ]; then
 | 
				
			||||||
 | 
						init=$(cat "$__global/explorer/init")
 | 
				
			||||||
 | 
						case $init in
 | 
				
			||||||
 | 
							init)
 | 
				
			||||||
 | 
								__config_file /etc/init.d/svscan --mode 755 --source "$__type/files/init.d-svscan"
 | 
				
			||||||
 | 
								require="$require __config_file/etc/init.d/svscan" __start_on_boot svscan
 | 
				
			||||||
 | 
								require="$require __start_on_boot/svscan" __process svscan --start 'service svscan start'
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
							*)
 | 
				
			||||||
 | 
								echo "Your init system ($init) is not supported by this type. Submit a patch at github.com/ungleich/cdist!"
 | 
				
			||||||
 | 
								exit 1
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						esac
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__daemontools/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__daemontools/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					install-init-script
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					daemontools
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__daemontools/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__daemontools/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					from-package
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__daemontools/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__daemontools/singleton
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										1
									
								
								cdist/conf/type/__daemontools_service/explorer/svc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__daemontools_service/explorer/svc
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					command -v svc
 | 
				
			||||||
							
								
								
									
										72
									
								
								cdist/conf/type/__daemontools_service/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								cdist/conf/type/__daemontools_service/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,72 @@
 | 
				
			||||||
 | 
					cdist-type__daemontools_service(7)
 | 
				
			||||||
 | 
					==================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__daemontools_service - Create a daemontools-compatible service dir.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					Create a directory structure compatible with daemontools-like service management.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Note that svc must be present on the target system.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The object ID will be used as the service name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					run
 | 
				
			||||||
 | 
					   Command to run. exec-ing and stderr redirection will be added. One of run, run-file must be specified.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   Example: `my-program`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					run-file
 | 
				
			||||||
 | 
					   File to save as <servicedir>/run. One of run, run-file must be specified.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   Example:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #!/bin/sh
 | 
				
			||||||
 | 
					    exec 2>&1
 | 
				
			||||||
 | 
					    exec my_program
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					log-run
 | 
				
			||||||
 | 
					   Command to run for log consumption. Default: `multilog t ./main`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					servicedir
 | 
				
			||||||
 | 
					   Directory to install into. Default: `/service`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN PARAMETERS
 | 
				
			||||||
 | 
					------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    require="__daemontools" __daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $FLAGS"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					:strong:`cdist-type__daemontools`\ (7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
							
								
								
									
										38
									
								
								cdist/conf/type/__daemontools_service/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								cdist/conf/type/__daemontools_service/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,38 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN_PREFIX="#!/bin/sh
 | 
				
			||||||
 | 
					exec 2>&1
 | 
				
			||||||
 | 
					exec "  # mind the space :D
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					name=$__object_id
 | 
				
			||||||
 | 
					servicedir=$(cat "$__object/parameter/servicedir")
 | 
				
			||||||
 | 
					run=$(cat "$__object/parameter/run")
 | 
				
			||||||
 | 
					runfile=$(cat "$__object/parameter/run-file")
 | 
				
			||||||
 | 
					logrun=$(cat "$__object/parameter/log-run")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					svc=$(cat "$__type/explorer/svc")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -z "$svc" ]; then
 | 
				
			||||||
 | 
						echo "svc not found! Install daemontools first: see __daemontools"
 | 
				
			||||||
 | 
						exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					badusage() {
 | 
				
			||||||
 | 
						echo "__daemontools_service/$__object_id: exactly one of --run, --run-file must be set" >&2
 | 
				
			||||||
 | 
						exit 1
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[ -z "$run$runfile" ] && badusage
 | 
				
			||||||
 | 
					[ -n "$run" ] && [ -n "$runfile" ] && badusage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__directory $servicedir/$name/log/main --parents
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "$RUN_PREFIX$run" | require="__directory/$servicedir/$name/log/main" __config_file "$servicedir/$name/run" \
 | 
				
			||||||
 | 
						--onchange "svc -t '$servicedir/$name' 2>/dev/null" \
 | 
				
			||||||
 | 
						--mode 755 \
 | 
				
			||||||
 | 
						--source "${runfile:--}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "$RUN_PREFIX$logrun" | require="__directory/$servicedir/$name/log/main" __config_file $servicedir/$name/log/run \
 | 
				
			||||||
 | 
						--onchange "svc -t '$servicedir/$name/log' 2>/dev/null" \
 | 
				
			||||||
 | 
						--mode 755 \
 | 
				
			||||||
 | 
						--source "-"
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					multilog t ./main
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					/service
 | 
				
			||||||
							
								
								
									
										4
									
								
								cdist/conf/type/__daemontools_service/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								cdist/conf/type/__daemontools_service/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,4 @@
 | 
				
			||||||
 | 
					log-run
 | 
				
			||||||
 | 
					run
 | 
				
			||||||
 | 
					run-file
 | 
				
			||||||
 | 
					servicedir
 | 
				
			||||||
| 
						 | 
					@ -26,17 +26,24 @@ BOOLEAN PARAMETERS
 | 
				
			||||||
experimental
 | 
					experimental
 | 
				
			||||||
   Install the experimental docker-engine package instead of the latest stable release.
 | 
					   Install the experimental docker-engine package instead of the latest stable release.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					   'present' or 'absent', defaults to 'present'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block:: sh
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Install docker
 | 
				
			||||||
    __docker
 | 
					    __docker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # experimental
 | 
					    # Install experimental
 | 
				
			||||||
    __docker --experimental
 | 
					    __docker --experimental
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Remove docker
 | 
				
			||||||
 | 
					    __docker --state absent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUTHORS
 | 
					AUTHORS
 | 
				
			||||||
-------
 | 
					-------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
os=$(cat "$__global/explorer/os")
 | 
					os=$(cat "$__global/explorer/os")
 | 
				
			||||||
 | 
					state=$(cat "$__object/parameter/state")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
    centos)
 | 
					    centos)
 | 
				
			||||||
| 
						 | 
					@ -27,31 +28,31 @@ case "$os" in
 | 
				
			||||||
        if [ -f "$__object/parameter/experimental" ]; then
 | 
					        if [ -f "$__object/parameter/experimental" ]; then
 | 
				
			||||||
          component="experimental"
 | 
					          component="experimental"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
      export CDIST_ORDER_DEPENDENCY=on
 | 
					 | 
				
			||||||
        __yum_repo docker \
 | 
					        __yum_repo docker \
 | 
				
			||||||
          --name 'Docker Repository' \
 | 
					          --name 'Docker Repository' \
 | 
				
			||||||
          --baseurl "https://yum.dockerproject.org/repo/$component/centos/\$releasever/" \
 | 
					          --baseurl "https://yum.dockerproject.org/repo/$component/centos/\$releasever/" \
 | 
				
			||||||
          --enabled \
 | 
					          --enabled \
 | 
				
			||||||
         --gpgcheck \
 | 
					          --gpgcheck 1 \
 | 
				
			||||||
         --gpgkey 'https://yum.dockerproject.org/gpg'
 | 
					          --gpgkey 'https://yum.dockerproject.org/gpg' \
 | 
				
			||||||
      __package docker-engine
 | 
					          --state ${state} 
 | 
				
			||||||
      unset CDIST_ORDER_DEPENDENCY
 | 
					        require="__yum_repo/docker" __package docker-engine --state ${state}
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
    ubuntu)
 | 
					    ubuntu)
 | 
				
			||||||
        component="main"
 | 
					        component="main"
 | 
				
			||||||
      if [ -f "$__object/parameter/experimental" ]; then
 | 
					      if [ -f "$__object/parameter/experimental" ]; then
 | 
				
			||||||
         component="experimental"
 | 
					         component="experimental"
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
      __package apparmor
 | 
					      __package apparmor --state ${state}
 | 
				
			||||||
      __package ca-certificates
 | 
					      __package ca-certificates --state ${state}
 | 
				
			||||||
      __package apt-transport-https
 | 
					      __package apt-transport-https --state ${state}
 | 
				
			||||||
      __apt_key docker --keyid 58118E89F3A912897C070ADBF76221572C52609D
 | 
					      __apt_key docker --keyid 58118E89F3A912897C070ADBF76221572C52609D --state ${state}
 | 
				
			||||||
      export CDIST_ORDER_DEPENDENCY=on
 | 
					      export CDIST_ORDER_DEPENDENCY=on
 | 
				
			||||||
      __apt_source docker \
 | 
					      __apt_source docker \
 | 
				
			||||||
         --uri https://apt.dockerproject.org/repo \
 | 
					         --uri https://apt.dockerproject.org/repo \
 | 
				
			||||||
         --distribution "ubuntu-$(cat "$__global/explorer/lsb_codename")" \
 | 
					         --distribution "ubuntu-$(cat "$__global/explorer/lsb_codename")" \
 | 
				
			||||||
 | 
					         --state ${state} \
 | 
				
			||||||
         --component "$component"
 | 
					         --component "$component"
 | 
				
			||||||
      __package docker-engine
 | 
					      __package docker-engine --state ${state}
 | 
				
			||||||
      unset CDIST_ORDER_DEPENDENCY
 | 
					      unset CDIST_ORDER_DEPENDENCY
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
   debian)
 | 
					   debian)
 | 
				
			||||||
| 
						 | 
					@ -60,16 +61,17 @@ case "$os" in
 | 
				
			||||||
         component="experimental"
 | 
					         component="experimental"
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      __package apt-transport-https
 | 
					      __package apt-transport-https --state ${state}
 | 
				
			||||||
      __package ca-certificates
 | 
					      __package ca-certificates --state ${state}
 | 
				
			||||||
      __package gnupg2
 | 
					      __package gnupg2 --state ${state}
 | 
				
			||||||
      __apt_key docker --keyid 58118E89F3A912897C070ADBF76221572C52609D
 | 
					      __apt_key docker --keyid 58118E89F3A912897C070ADBF76221572C52609D --state ${state}
 | 
				
			||||||
      export CDIST_ORDER_DEPENDENCY=on
 | 
					      export CDIST_ORDER_DEPENDENCY=on
 | 
				
			||||||
      __apt_source docker \
 | 
					      __apt_source docker \
 | 
				
			||||||
          --uri https://apt.dockerproject.org/repo \
 | 
					          --uri https://apt.dockerproject.org/repo \
 | 
				
			||||||
          --distribution "debian-$(cat "$__global/explorer/lsb_codename")" \
 | 
					          --distribution "debian-$(cat "$__global/explorer/lsb_codename")" \
 | 
				
			||||||
 | 
					          --state ${state} \
 | 
				
			||||||
          --component "$component"
 | 
					          --component "$component"
 | 
				
			||||||
      __package docker-engine
 | 
					      __package docker-engine --state ${state}
 | 
				
			||||||
      unset CDIST_ORDER_DEPENDENCY
 | 
					      unset CDIST_ORDER_DEPENDENCY
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__docker/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__docker/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					present
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__docker/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__docker/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
							
								
								
									
										31
									
								
								cdist/conf/type/__docker_compose/gencode-remote
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								cdist/conf/type/__docker_compose/gencode-remote
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,31 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 2016 Dominique Roux (dominique.roux 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/>.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Variables
 | 
				
			||||||
 | 
					version="$(cat "$__object/parameter/version")"
 | 
				
			||||||
 | 
					state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ${state} = "present" ]; then
 | 
				
			||||||
 | 
					    # Download docker-compose file
 | 
				
			||||||
 | 
					        echo 'curl -L "https://github.com/docker/compose/releases/download/'${version}'/docker-compose-$(uname -s)-$(uname -m)" -o /tmp/docker-compose'
 | 
				
			||||||
 | 
					        echo 'mv /tmp/docker-compose /usr/local/bin/docker-compose'
 | 
				
			||||||
 | 
					    # Change permissions
 | 
				
			||||||
 | 
					    echo 'chmod +x /usr/local/bin/docker-compose'
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
							
								
								
									
										58
									
								
								cdist/conf/type/__docker_compose/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								cdist/conf/type/__docker_compose/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,58 @@
 | 
				
			||||||
 | 
					cdist-type__docker_compose(7)
 | 
				
			||||||
 | 
					=============================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__docker_compose - install docker-compose
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					Installs docker-compose package.
 | 
				
			||||||
 | 
					State 'absent' will not remove docker binary itself,
 | 
				
			||||||
 | 
					only docker-compose binary will be removed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					version
 | 
				
			||||||
 | 
					   Define docker_compose version, defaults to "1.9.0" 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					   'present' or 'absent', defaults to 'present'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN PARAMETERS
 | 
				
			||||||
 | 
					------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Install docker-compose
 | 
				
			||||||
 | 
					    __docker_compose
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Install version 1.9.0-rc4
 | 
				
			||||||
 | 
					    __docker_compose --version 1.9.0-rc4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Remove docker-compose 
 | 
				
			||||||
 | 
					    __docker_compose --state absent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AUTHORS
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Dominique Roux <dominique.roux--@--ungleich.ch>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Copyright \(C) 2016 Dominique Roux. Free use of this software is
 | 
				
			||||||
 | 
					granted under the terms of the GNU General Public License version 3 or later (GPLv3+).
 | 
				
			||||||
							
								
								
									
										33
									
								
								cdist/conf/type/__docker_compose/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								cdist/conf/type/__docker_compose/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,33 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 2016 Dominique Roux (dominique.roux 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/>.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Needed packages
 | 
				
			||||||
 | 
					if [ ${state} = "present" ]; then
 | 
				
			||||||
 | 
					    __docker
 | 
				
			||||||
 | 
					    __package curl
 | 
				
			||||||
 | 
					elif [ ${state} = "absent" ]; then
 | 
				
			||||||
 | 
					    __file /usr/local/bin/docker-compose --state absent
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    echo "Unknown state: ${state}" >&2
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__docker_compose/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__docker_compose/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					present
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					1.12.0
 | 
				
			||||||
							
								
								
									
										2
									
								
								cdist/conf/type/__docker_compose/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/type/__docker_compose/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					version
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__docker_compose/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__docker_compose/singleton
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										27
									
								
								cdist/conf/type/__dot_file/explorer/home
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										27
									
								
								cdist/conf/type/__dot_file/explorer/home
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,27 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					# Copyright (C) 2016 Dmitry Bogatov <KAction@gnu.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Author: Dmitry Bogatov <KAction@gnu.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This program 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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					set -eu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					user="$(cat "${__object}/parameter/user")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if which getent >/dev/null 2>&1; then
 | 
				
			||||||
 | 
						line=$(getent passwd "${user}")
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						line=$(grep "^${user}:" /etc/passwd)
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					printf '%s' "$line" | cut -d: -f6
 | 
				
			||||||
							
								
								
									
										21
									
								
								cdist/conf/type/__dot_file/explorer/primary_group
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								cdist/conf/type/__dot_file/explorer/primary_group
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,21 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					# Copyright (C) 2016 Dmitry Bogatov <kaction@sagulo>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Author: Dmitry Bogatov <kaction@sagulo>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This program 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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					set -eu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					user="$(cat "${__object}/parameter/user")"
 | 
				
			||||||
 | 
					id -gn "${user}"
 | 
				
			||||||
							
								
								
									
										71
									
								
								cdist/conf/type/__dot_file/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								cdist/conf/type/__dot_file/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,71 @@
 | 
				
			||||||
 | 
					cdist-type__dot_file(7)
 | 
				
			||||||
 | 
					========================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cdist-type__dot_file - install file under user's home directory
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This type installs a file (=\ *__object_id*) under user's home directory,
 | 
				
			||||||
 | 
					providing a way to install per-user configuration files. File owner
 | 
				
			||||||
 | 
					and group is deduced from user, for who file is installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Unlike regular __file type, you do not need make any assumptions,
 | 
				
			||||||
 | 
					where user's home directory is.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					user
 | 
				
			||||||
 | 
					    User, for who file is installed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mode
 | 
				
			||||||
 | 
					    forwarded to :strong:`__file` type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					    forwarded to :strong:`__file` type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					source
 | 
				
			||||||
 | 
					    forwarded to :strong:`__file` type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MESSAGES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This type inherits all messages from :strong:`file` type, and do not add
 | 
				
			||||||
 | 
					any new.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Install .forward file for user 'alice'. Since state is 'present',
 | 
				
			||||||
 | 
					    # user is not meant to edit this file, all changes will be overridden.
 | 
				
			||||||
 | 
					    # It is good idea to put warning about it in file itself.
 | 
				
			||||||
 | 
					    __dot_file .forward --user alice --source "$__files/forward"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Install .muttrc for user 'bob', if not already present. User can safely
 | 
				
			||||||
 | 
					    # edit it, his changes will not be overwritten.
 | 
				
			||||||
 | 
					    __dot_file .muttrc --user bob --source "$__files/recommended_mutt_config" --state exists
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Install default xmonad config for user 'eve'. Parent directory is created automatically.
 | 
				
			||||||
 | 
					    __dot_file .xmonad/xmonad.hs --user eve --state exists --source "$__files/xmonad.hs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**cdist-type__file**\ (7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (C) 2015 Dmitry Bogatov. Free use of this software is granted
 | 
				
			||||||
 | 
					under the terms of the GNU General Public License version 3 or later
 | 
				
			||||||
 | 
					(GPLv3+).
 | 
				
			||||||
							
								
								
									
										65
									
								
								cdist/conf/type/__dot_file/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										65
									
								
								cdist/conf/type/__dot_file/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,65 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Copyright (C) 2016  Bogatov Dmitry <KAction@gnu.org>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This program 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.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					set -eu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					user="$(cat "${__object}/parameter/user")"
 | 
				
			||||||
 | 
					home="$(cat "${__object}/explorer/home")"
 | 
				
			||||||
 | 
					primary_group="$(cat "${__object}/explorer/primary_group")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Create parent directory. Type __directory has flag 'parents', but it
 | 
				
			||||||
 | 
					# will leave us with root-owned directory in user home, which is not
 | 
				
			||||||
 | 
					# acceptable. So we create parent directories one-by-one. XXX: maybe
 | 
				
			||||||
 | 
					# it should be fixed in '__directory'?
 | 
				
			||||||
 | 
					set --
 | 
				
			||||||
 | 
					subpath=${__object_id}
 | 
				
			||||||
 | 
					while subpath="$(dirname "${subpath}")" ; do
 | 
				
			||||||
 | 
						[ "${subpath}" = . ] && break
 | 
				
			||||||
 | 
						set -- "${subpath}" "$@"
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					unset subpath
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export CDIST_ORDER_DEPENDENCY
 | 
				
			||||||
 | 
					for dir ; do
 | 
				
			||||||
 | 
						__directory "${home}/${dir}"   \
 | 
				
			||||||
 | 
						    --group "${primary_group}" \
 | 
				
			||||||
 | 
						    --owner "${user}"
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# These parameters are forwarded to __file type. 'mode' is always
 | 
				
			||||||
 | 
					# present, since it have been given default.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set --
 | 
				
			||||||
 | 
					for p in state mode source ; do
 | 
				
			||||||
 | 
						if [ -f "${__object}/parameter/${p}" ] ; then
 | 
				
			||||||
 | 
							value="$(cat "${__object}/parameter/${p}")"
 | 
				
			||||||
 | 
							set -- "$@" "--${p}" "${value}"
 | 
				
			||||||
 | 
							unset value
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# If source is `-' we can't just forward it, since stdin is already
 | 
				
			||||||
 | 
					# captured by __dot_file.  So, we replace '-' with "$__object/stdin".
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# It means that it is possible for __file to receive --source
 | 
				
			||||||
 | 
					# parameter twice, but, since latest wins, it is okay.
 | 
				
			||||||
 | 
					source="$(cat "${__object}/parameter/source")"
 | 
				
			||||||
 | 
					if [ "${source}" = "-" ] ; then
 | 
				
			||||||
 | 
						set -- "$@" --source "${__object}/stdin"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					unset source
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__file "${home}/${__object_id}" --owner "$user" --group "$primary_group" "$@"
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__dot_file/parameter/default/mode
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__dot_file/parameter/default/mode
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					600
 | 
				
			||||||
							
								
								
									
										3
									
								
								cdist/conf/type/__dot_file/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								cdist/conf/type/__dot_file/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					mode
 | 
				
			||||||
 | 
					source
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__dot_file/parameter/required
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__dot_file/parameter/required
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					user
 | 
				
			||||||
							
								
								
									
										3
									
								
								cdist/conf/type/__go_get/explorer/go-executable
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								cdist/conf/type/__go_get/explorer/go-executable
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					[ -f /etc/environment ] && . /etc/environment
 | 
				
			||||||
 | 
					[ -f /etc/profile     ] && . /etc/profile
 | 
				
			||||||
 | 
					go version 2>/dev/null || true
 | 
				
			||||||
							
								
								
									
										8
									
								
								cdist/conf/type/__go_get/gencode-remote
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								cdist/conf/type/__go_get/gencode-remote
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					package=$__object_id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cat<<EOF
 | 
				
			||||||
 | 
					[ -f /etc/environment ] && . /etc/environment
 | 
				
			||||||
 | 
					[ -f /etc/profile     ] && . /etc/profile
 | 
				
			||||||
 | 
					export GOPATH=\${GOPATH:-/opt/gocode}
 | 
				
			||||||
 | 
					go get $package
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
							
								
								
									
										48
									
								
								cdist/conf/type/__go_get/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								cdist/conf/type/__go_get/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,48 @@
 | 
				
			||||||
 | 
					cdist-type__go_get(7)
 | 
				
			||||||
 | 
					=====================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__go_get - Install go packages with go get
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					This cdist type allows you to install golang packages with go get.
 | 
				
			||||||
 | 
					A sufficiently recent version of go must be present on the system.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The object ID is the go package to be installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __go_get github.com/prometheus/prometheus/cmd/...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # usually you'd need to require golang from somewhere:
 | 
				
			||||||
 | 
					    require="__golang_from_vendor" __go_get github.com/prometheus/prometheus/cmd/...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
							
								
								
									
										17
									
								
								cdist/conf/type/__go_get/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								cdist/conf/type/__go_get/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					go_executable=$(cat "$__object/explorer/go-executable")
 | 
				
			||||||
 | 
					[ -z "$go_executable" ] && echo "__go_get: Cannot find go executable; make sure it is installed and in PATH" >&2 && exit 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					os=$(cat "$__global/explorer/os")
 | 
				
			||||||
 | 
					case $os in
 | 
				
			||||||
 | 
						debian|devuan|ubuntu)
 | 
				
			||||||
 | 
							__package build-essential
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						*)
 | 
				
			||||||
 | 
							echo "__go_get: Don't know how to install g++ on $os" >&2
 | 
				
			||||||
 | 
							echo "__go_get: Send a pull request or contact <kamila@ksp.sk> to add support for $os." >&2
 | 
				
			||||||
 | 
							exit 1
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										26
									
								
								cdist/conf/type/__golang_from_vendor/gencode-remote
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								cdist/conf/type/__golang_from_vendor/gencode-remote
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,26 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					version=$(cat "$__object/parameter/version")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					kernel_name=$(cat "$__global/explorer/kernel_name" | tr '[:upper:]' '[:lower:]')
 | 
				
			||||||
 | 
					machine=$(cat "$__global/explorer/machine")
 | 
				
			||||||
 | 
					case $machine in
 | 
				
			||||||
 | 
						x86_64|amd64)
 | 
				
			||||||
 | 
							arch=amd64
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						x86)
 | 
				
			||||||
 | 
							arch=386
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						*)
 | 
				
			||||||
 | 
							arch=$machine  # at least try...
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PACKAGE="go${version}.${kernel_name}-${arch}"
 | 
				
			||||||
 | 
					URL="https://storage.googleapis.com/golang/${PACKAGE}.tar.gz"
 | 
				
			||||||
 | 
					cat <<EOF
 | 
				
			||||||
 | 
					[ "x\$(cat /usr/local/go/VERSION 2>/dev/null)" = "xgo$version" ] && exit 0  # already there
 | 
				
			||||||
 | 
					wget --no-verbose "$URL" -O "/tmp/${PACKAGE}.tar.gz"
 | 
				
			||||||
 | 
					rm -rf /usr/local/go
 | 
				
			||||||
 | 
					tar -C /usr/local -xzf /tmp/${PACKAGE}.tar.gz
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
							
								
								
									
										48
									
								
								cdist/conf/type/__golang_from_vendor/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								cdist/conf/type/__golang_from_vendor/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,48 @@
 | 
				
			||||||
 | 
					cdist-type__golang_from_vendor(7)
 | 
				
			||||||
 | 
					=================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__golang_from_vendor - Install any version of golang from golang.org
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					This cdist type allows you to install golang from archives provided by https://golang.org/dl/.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See https://golang.org/dl/ for the list of supported versions, operating systems and architectures.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This is a singleton type.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					version
 | 
				
			||||||
 | 
					    The golang version to install, defaults to 1.8.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __golang_from_vendor --version 1.8.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__golang_from_vendor/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__golang_from_vendor/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					__line go_in_path --line 'export PATH=/usr/local/go/bin:$PATH' --file /etc/profile
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					1.8.1
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__golang_from_vendor/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__golang_from_vendor/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					version
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__golang_from_vendor/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__golang_from_vendor/singleton
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										43
									
								
								cdist/conf/type/__grafana_dashboard/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								cdist/conf/type/__grafana_dashboard/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,43 @@
 | 
				
			||||||
 | 
					cdist-type__grafana_dashboard(7)
 | 
				
			||||||
 | 
					================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__grafana_dashboard - Install Grafana (https://grafana.com)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					This cdist type adds the Grafana repository, installs the grafana package, and sets the server to start on boot.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This is a singleton type.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __grafana_dashboard
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
							
								
								
									
										32
									
								
								cdist/conf/type/__grafana_dashboard/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								cdist/conf/type/__grafana_dashboard/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,32 @@
 | 
				
			||||||
 | 
					os=$(cat $__global/explorer/os)
 | 
				
			||||||
 | 
					os_version=$(cat $__global/explorer/os_version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					case $os in
 | 
				
			||||||
 | 
					    debian|devuan)
 | 
				
			||||||
 | 
					        case $os_version in
 | 
				
			||||||
 | 
					            8*|jessie)
 | 
				
			||||||
 | 
					                __apt_key_uri grafana \
 | 
				
			||||||
 | 
					                   --name 'Grafana Release Signing Key' \
 | 
				
			||||||
 | 
					                   --uri https://packagecloud.io/gpg.key
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                require="__apt_key_uri/grafana" __apt_source grafana \
 | 
				
			||||||
 | 
					                   --uri https://packagecloud.io/grafana/stable/debian/ \
 | 
				
			||||||
 | 
					                   --distribution jessie \
 | 
				
			||||||
 | 
					                   --component main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                __package apt-transport-https
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                require="__apt_source/grafana __package/apt-transport-https" __package grafana
 | 
				
			||||||
 | 
					                require="__package/grafana" __start_on_boot grafana-server
 | 
				
			||||||
 | 
					            ;;
 | 
				
			||||||
 | 
					            *)
 | 
				
			||||||
 | 
					                echo "Don't know how to install Grafana on $os $os_version. Send us a pull request!"
 | 
				
			||||||
 | 
					                exit 1
 | 
				
			||||||
 | 
					            ;;
 | 
				
			||||||
 | 
					        esac
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					    *)
 | 
				
			||||||
 | 
					        echo "Don't know how to install Grafana on $os. Send us a pull request!"
 | 
				
			||||||
 | 
					        exit 1
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__grafana_dashboard/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__grafana_dashboard/singleton
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										55
									
								
								cdist/conf/type/__hosts/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								cdist/conf/type/__hosts/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,55 @@
 | 
				
			||||||
 | 
					cdist-type__hosts(7)
 | 
				
			||||||
 | 
					====================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cdist-type__hosts - manage entries in /etc/hosts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Add or remove entries from */etc/hosts* file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					    If state is ``present``, make *object_id* resolve to *ip*. If
 | 
				
			||||||
 | 
					    state is ``absent``, *object_id* will no longer resolve via
 | 
				
			||||||
 | 
					    */etc/hosts*, if it was previously configured with this type.
 | 
				
			||||||
 | 
					    Manually inserted entries are unaffected.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ip
 | 
				
			||||||
 | 
					    IP address, to which hostname (=\ *object_id*) must resolve. If
 | 
				
			||||||
 | 
					    state is ``present``, this parameter is mandatory, if state is
 | 
				
			||||||
 | 
					    ``absent``, this parameter is silently ignored.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Now `funny' resolves to 192.168.1.76,
 | 
				
			||||||
 | 
					    __hosts funny --ip 192.168.1.76
 | 
				
			||||||
 | 
					    # and `happy' no longer resolve via /etc/hosts if it was
 | 
				
			||||||
 | 
					    # previously configured via __hosts.
 | 
				
			||||||
 | 
					    __hosts happy --state absent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:strong:`hosts`\ (5)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AUTHORS
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Dmitry Bogatov <KAction@gnu.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (C) 2015,2016 Dmitry Bogatov. Free use of this software is granted
 | 
				
			||||||
 | 
					under the terms of the GNU General Public License version 3 or later
 | 
				
			||||||
 | 
					(GPLv3+).
 | 
				
			||||||
							
								
								
									
										29
									
								
								cdist/conf/type/__hosts/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								cdist/conf/type/__hosts/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,29 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					# Copyright (C) 2015  Bogatov Dmitry <KAction@gnu.org>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This program 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.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					set -ue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					hostname="$__object_id"
 | 
				
			||||||
 | 
					state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					marker="# __hosts/$hostname"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -- "__hosts/$hostname" --file /etc/hosts --state "$state"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "$state" = absent ] ; then
 | 
				
			||||||
 | 
						__line "$@" --regex "$marker"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						ip="$(cat "$__object/parameter/ip")"
 | 
				
			||||||
 | 
						__line "$@" --line "$ip $hostname $marker"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__hosts/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__hosts/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					present
 | 
				
			||||||
							
								
								
									
										2
									
								
								cdist/conf/type/__hosts/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/type/__hosts/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					ip
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
../__chroot_mount/man.rst
 | 
					 | 
				
			||||||
							
								
								
									
										42
									
								
								cdist/conf/type/__install_chroot_mount/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								cdist/conf/type/__install_chroot_mount/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,42 @@
 | 
				
			||||||
 | 
					cdist-type__install_chroot_mount(7)
 | 
				
			||||||
 | 
					===================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__install_chroot_mount - mount a chroot with install command
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					Mount and prepare a chroot for running commands within it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __install_chroot_mount /path/to/chroot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AUTHORS
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
../__chroot_umount/man.rst
 | 
					 | 
				
			||||||
							
								
								
									
										47
									
								
								cdist/conf/type/__install_chroot_umount/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								cdist/conf/type/__install_chroot_umount/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,47 @@
 | 
				
			||||||
 | 
					cdist-type__install_chroot_umount(7)
 | 
				
			||||||
 | 
					====================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__install_chroot_umount - unmount a chroot mounted by __install_chroot_mount
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					Undo what __install_chroot_mount did.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __install_chroot_umount /path/to/chroot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					:strong:`cdist-type__install_chroot_mount`\ (7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AUTHORS
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
../__file/man.rst
 | 
					 | 
				
			||||||
							
								
								
									
										112
									
								
								cdist/conf/type/__install_file/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								cdist/conf/type/__install_file/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,112 @@
 | 
				
			||||||
 | 
					cdist-type__install_file(7)
 | 
				
			||||||
 | 
					===========================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__install_file - Manage files with install command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					This cdist type allows you to create files, remove files and set file
 | 
				
			||||||
 | 
					attributes on the target.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If the file already exists on the target, then if it is a:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					regular file, and state is:
 | 
				
			||||||
 | 
					  present
 | 
				
			||||||
 | 
					    replace it with the source file if they are not equal
 | 
				
			||||||
 | 
					  exists
 | 
				
			||||||
 | 
					    do nothing
 | 
				
			||||||
 | 
					symlink
 | 
				
			||||||
 | 
					  replace it with the source file
 | 
				
			||||||
 | 
					directory
 | 
				
			||||||
 | 
					  replace it with the source file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In any case, make sure that the file attributes are as specified.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					   'present', 'absent' or 'exists', defaults to 'present' where:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   present
 | 
				
			||||||
 | 
					      the file is exactly the one from source
 | 
				
			||||||
 | 
					   absent
 | 
				
			||||||
 | 
					      the file does not exist
 | 
				
			||||||
 | 
					   exists
 | 
				
			||||||
 | 
					      the file from source but only if it doesn't already exist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					group
 | 
				
			||||||
 | 
					   Group to chgrp to.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mode
 | 
				
			||||||
 | 
					   Unix permissions, suitable for chmod.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					owner
 | 
				
			||||||
 | 
					   User to chown to.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					source
 | 
				
			||||||
 | 
					   If supplied, copy this file from the host running cdist to the target.
 | 
				
			||||||
 | 
					   If not supplied, an empty file or directory will be created.
 | 
				
			||||||
 | 
					   If source is '-' (dash), take what was written to stdin as the file content.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MESSAGES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					chgrp <group>
 | 
				
			||||||
 | 
					   Changed group membership
 | 
				
			||||||
 | 
					chown <owner>
 | 
				
			||||||
 | 
					   Changed owner
 | 
				
			||||||
 | 
					chmod <mode>
 | 
				
			||||||
 | 
					   Changed mode
 | 
				
			||||||
 | 
					create
 | 
				
			||||||
 | 
					   Empty file was created (no --source specified)
 | 
				
			||||||
 | 
					remove
 | 
				
			||||||
 | 
					   File exists, but state is absent, file will be removed by generated code.
 | 
				
			||||||
 | 
					upload
 | 
				
			||||||
 | 
					   File was uploaded
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Create  /etc/cdist-configured as an empty file
 | 
				
			||||||
 | 
					    __install_file /etc/cdist-configured
 | 
				
			||||||
 | 
					    # The same thing
 | 
				
			||||||
 | 
					    __install_file /etc/cdist-configured --state present
 | 
				
			||||||
 | 
					    # Use __file from another type
 | 
				
			||||||
 | 
					    __install_file /etc/issue --source "$__type/files/archlinux" --state present
 | 
				
			||||||
 | 
					    # Delete existing file
 | 
				
			||||||
 | 
					    __install_file /etc/cdist-configured --state absent
 | 
				
			||||||
 | 
					    # Supply some more settings
 | 
				
			||||||
 | 
					    __install_file /etc/shadow --source "$__type/files/shadow" \
 | 
				
			||||||
 | 
					       --owner root --group shadow --mode 0640 \
 | 
				
			||||||
 | 
					       --state present
 | 
				
			||||||
 | 
					    # Provide a default file, but let the user change it
 | 
				
			||||||
 | 
					    __install_file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
 | 
				
			||||||
 | 
					       --state exists \
 | 
				
			||||||
 | 
					       --owner frodo --mode 0600
 | 
				
			||||||
 | 
					    # Take file content from stdin
 | 
				
			||||||
 | 
					    __install_file /tmp/whatever --owner root --group root --mode 644 --source - << DONE
 | 
				
			||||||
 | 
					        Here goes the content for /tmp/whatever
 | 
				
			||||||
 | 
					    DONE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AUTHORS
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Nico Schottelius <nico-cdist--@--schottelius.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
| 
						 | 
					@ -8,16 +8,16 @@ cdist-type__package_dpkg - Manage packages with dpkg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DESCRIPTION
 | 
					DESCRIPTION
 | 
				
			||||||
-----------
 | 
					-----------
 | 
				
			||||||
__package_dpkg is used on Debian and variants (like Ubuntu) to
 | 
					This type is used on Debian and variants (like Ubuntu) to
 | 
				
			||||||
install packages that are provided locally as *.deb files.
 | 
					install packages that are provided locally as \*.deb files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The object given to __package_dpkg must be the name of the deb package.
 | 
					The object given to this type must be the name of the deb package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REQUIRED PARAMETERS
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
source
 | 
					source
 | 
				
			||||||
    path to the *.deb package
 | 
					    path to the \*.deb package
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,13 +14,13 @@ The object you need to pass to __postgres_extension consists of
 | 
				
			||||||
the database name and the extension name joined by a colon in the
 | 
					the database name and the extension name joined by a colon in the
 | 
				
			||||||
following form:
 | 
					following form:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block::
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dbname:extension
 | 
					    dbname:extension
 | 
				
			||||||
 | 
					
 | 
				
			||||||
f.ex.
 | 
					f.ex.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. code-block::
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rails_test:unaccent
 | 
					    rails_test:unaccent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										66
									
								
								cdist/conf/type/__prometheus_alertmanager/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								cdist/conf/type/__prometheus_alertmanager/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,66 @@
 | 
				
			||||||
 | 
					cdist-type__prometheus_alertmanager(7)
 | 
				
			||||||
 | 
					======================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__prometheus_alertmanager - install Alertmanager
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					Install and configure Prometheus Alertmanager (https://prometheus.io/docs/alerting/alertmanager/).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN PARAMETERS
 | 
				
			||||||
 | 
					------------------
 | 
				
			||||||
 | 
					with-daemontools
 | 
				
			||||||
 | 
					   Create a daemontools service directory under /service/prometheus. Default: yes.
 | 
				
			||||||
 | 
					   Note: If you do not use this, Alertmanager will not be launched, and will not reload config on change.
 | 
				
			||||||
 | 
					   If you use this, daemontools (or something compatible) must be installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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 \
 | 
				
			||||||
 | 
					      --config "$__manifest/files/alertmanager.yml" \
 | 
				
			||||||
 | 
					      --storage-path /data/alertmanager \
 | 
				
			||||||
 | 
					      --listen-address "[::]:$ALERTPORT"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					:strong:`cdist-type__prometheus_server`\ (7), :strong:`cdist-type__daemontools`\ (7),
 | 
				
			||||||
 | 
					Prometheus alerting documentation: https://prometheus.io/docs/alerting/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.
 | 
				
			||||||
							
								
								
									
										39
									
								
								cdist/conf/type/__prometheus_alertmanager/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								cdist/conf/type/__prometheus_alertmanager/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,39 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GOBIN=/opt/gocode/bin  # where to find go binaries
 | 
				
			||||||
 | 
					CONF_DIR=/etc/prometheus
 | 
				
			||||||
 | 
					LOGLEVEL=info
 | 
				
			||||||
 | 
					CONF=$CONF_DIR/alertmanager.yml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Prometheus server #######################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					config="$(cat "$__object/parameter/config")"
 | 
				
			||||||
 | 
					storage_path="$(cat "$__object/parameter/storage-path")"
 | 
				
			||||||
 | 
					listen_address="$(cat "$__object/parameter/listen-address")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ONCHANGE=""
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/with-daemontools" ]; then
 | 
				
			||||||
 | 
						__daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $REAL_FLAGS"
 | 
				
			||||||
 | 
						ONCHANGE="svc -h /service/prometheus"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FLAGS="config.file '$CONF'
 | 
				
			||||||
 | 
					storage.path '$storage_path'
 | 
				
			||||||
 | 
					web.listen-address '$listen_address'
 | 
				
			||||||
 | 
					log.level $LOGLEVEL"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REAL_FLAGS="$(echo "$FLAGS" | sed -nE 's/^([^#]+).*/ --\1 \\/p')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__go_get github.com/prometheus/alertmanager/cmd/...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__user prometheus --system
 | 
				
			||||||
 | 
					__directory "$storage_path" --owner prometheus
 | 
				
			||||||
 | 
					__directory "$CONF_DIR" --owner prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__daemontools_service alertmanager --run "setuidgid prometheus $GOBIN/alertmanager $REAL_FLAGS"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require="$require __directory/$storage_path" \
 | 
				
			||||||
 | 
					__config_file $CONF \
 | 
				
			||||||
 | 
					    --source $config \
 | 
				
			||||||
 | 
					    --group prometheus --mode 640 \
 | 
				
			||||||
 | 
					    --onchange "$ONCHANGE"
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					/data/alertmanager
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					storage-path
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					config
 | 
				
			||||||
 | 
					listen-address
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__prometheus_alertmanager/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__prometheus_alertmanager/singleton
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										78
									
								
								cdist/conf/type/__prometheus_server/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								cdist/conf/type/__prometheus_server/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,78 @@
 | 
				
			||||||
 | 
					cdist-type__prometheus_server(7)
 | 
				
			||||||
 | 
					================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__prometheus_server - install Prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					Install and configure Prometheus (https://prometheus.io/).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					retention-days
 | 
				
			||||||
 | 
					   How long to keep data. Default: 30
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
 | 
					------------------
 | 
				
			||||||
 | 
					with-daemontools
 | 
				
			||||||
 | 
					   Create a daemontools service directory under /service/prometheus. Default: yes.
 | 
				
			||||||
 | 
					   Note: If you do not use this, Prometheus will not be launched, and will not reload config on change.
 | 
				
			||||||
 | 
					   If you use this, daemontools (or something compatible) must be installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    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 \
 | 
				
			||||||
 | 
					        --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"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					:strong:`cdist-type__prometheus_alertmanager`\ (7), :strong:`cdist-type__daemontools`\ (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.
 | 
				
			||||||
							
								
								
									
										57
									
								
								cdist/conf/type/__prometheus_server/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								cdist/conf/type/__prometheus_server/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,57 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GOBIN=/opt/gocode/bin  # where to find go binaries
 | 
				
			||||||
 | 
					CONF_DIR=/etc/prometheus
 | 
				
			||||||
 | 
					CONF=$CONF_DIR/prometheus.yml
 | 
				
			||||||
 | 
					LOGLEVEL=info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					config="$(cat "$__object/parameter/config")"
 | 
				
			||||||
 | 
					retention_days="$(cat "$__object/parameter/retention-days")"
 | 
				
			||||||
 | 
					storage_path="$(cat "$__object/parameter/storage-path")"
 | 
				
			||||||
 | 
					listen_address="$(cat "$__object/parameter/listen-address")"
 | 
				
			||||||
 | 
					alertmanager_url="$(cat "$__object/parameter/alertmanager-url")"
 | 
				
			||||||
 | 
					target_heap_size="$(cat "$__object/parameter/target-heap-size")"
 | 
				
			||||||
 | 
					rule_files="$(cat "$__object/parameter/rule-files")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# explorer in kB => convert; by default we go with 1/2 RAM
 | 
				
			||||||
 | 
					[ "$target_heap_size" = "auto" ] && target_heap_size=$(($(cat $__global/explorer/memory)*1024/2))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ONCHANGE=""
 | 
				
			||||||
 | 
					if [ -f "$__object/parameter/with-daemontools" ]; then
 | 
				
			||||||
 | 
						__daemontools_service prometheus --run "setuidgid prometheus $GOBIN/prometheus $REAL_FLAGS"
 | 
				
			||||||
 | 
						ONCHANGE="&& svc -h /service/prometheus"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FLAGS="config.file '$CONF'
 | 
				
			||||||
 | 
					storage.local.path '$storage_path'
 | 
				
			||||||
 | 
					storage.local.target-heap-size $(($target_heap_size))  # in bytes; should be 2/3 of available memory because it may be hungry
 | 
				
			||||||
 | 
					storage.local.retention $(($retention_days*24))h  # golang doesn't have days :D
 | 
				
			||||||
 | 
					web.listen-address '$listen_address'
 | 
				
			||||||
 | 
					alertmanager.url '$alertmanager_url'
 | 
				
			||||||
 | 
					log.level $LOGLEVEL"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REAL_FLAGS="$(echo "$FLAGS" | sed -nE 's/^([^#]+).*/ --\1 \\/p')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__go_get github.com/prometheus/prometheus/cmd/...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__user prometheus --system
 | 
				
			||||||
 | 
					__directory "$storage_path" --owner prometheus
 | 
				
			||||||
 | 
					__directory "$CONF_DIR" --owner prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require="$require __directory/$storage_path" \
 | 
				
			||||||
 | 
					__config_file $CONF \
 | 
				
			||||||
 | 
						--source $config \
 | 
				
			||||||
 | 
						--group prometheus --mode 640 \
 | 
				
			||||||
 | 
						--onchange "$GOBIN/promtool check-config $CONF $ONCHANGE"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for file in $rule_files; do
 | 
				
			||||||
 | 
						dest=$CONF_DIR/$(basename $file)
 | 
				
			||||||
 | 
						require="$require __directory/$CONF_DIR" \
 | 
				
			||||||
 | 
						__config_file "$dest" \
 | 
				
			||||||
 | 
							--source "$file" \
 | 
				
			||||||
 | 
							--owner prometheus \
 | 
				
			||||||
 | 
							--onchange "$GOBIN/promtool check-rules '$dest' $ONCHANGE"
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__prometheus_server/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__prometheus_server/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					with-daemontools
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					30
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					/data/prometheus
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					auto
 | 
				
			||||||
							
								
								
									
										4
									
								
								cdist/conf/type/__prometheus_server/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								cdist/conf/type/__prometheus_server/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,4 @@
 | 
				
			||||||
 | 
					target-heap-size
 | 
				
			||||||
 | 
					retention-days
 | 
				
			||||||
 | 
					rule-files
 | 
				
			||||||
 | 
					storage-path
 | 
				
			||||||
							
								
								
									
										3
									
								
								cdist/conf/type/__prometheus_server/parameter/required
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								cdist/conf/type/__prometheus_server/parameter/required
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					alertmanager-url
 | 
				
			||||||
 | 
					config
 | 
				
			||||||
 | 
					listen-address
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__prometheus_server/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__prometheus_server/singleton
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -54,6 +54,9 @@ case "$state_should" in
 | 
				
			||||||
                        ;;
 | 
					                        ;;
 | 
				
			||||||
                    esac
 | 
					                    esac
 | 
				
			||||||
                ;;
 | 
					                ;;
 | 
				
			||||||
 | 
					                devuan)
 | 
				
			||||||
 | 
					                    echo "update-rc.d \"$name\" defaults >/dev/null"
 | 
				
			||||||
 | 
					                ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                gentoo)
 | 
					                gentoo)
 | 
				
			||||||
                    echo rc-update add \"$name\" \"$target_runlevel\"
 | 
					                    echo rc-update add \"$name\" \"$target_runlevel\"
 | 
				
			||||||
| 
						 | 
					@ -90,7 +93,7 @@ case "$state_should" in
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            case "$os" in
 | 
					            case "$os" in
 | 
				
			||||||
                debian|ubuntu)
 | 
					                debian|ubuntu|devuan)
 | 
				
			||||||
                    echo update-rc.d -f \"$name\" remove
 | 
					                    echo update-rc.d -f \"$name\" remove
 | 
				
			||||||
                ;;
 | 
					                ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@
 | 
				
			||||||
os=$(cat "$__global/explorer/os")
 | 
					os=$(cat "$__global/explorer/os")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
   redhat|centos|ubuntu|debian|archlinux)
 | 
					   redhat|centos|ubuntu|debian|devuan|archlinux)
 | 
				
			||||||
      :
 | 
					      :
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
   *)
 | 
					   *)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,11 +18,4 @@
 | 
				
			||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
					# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
os="$($__explorer/os)"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [ "$os" = "netbsd" ]; then
 | 
					 | 
				
			||||||
    echo netbsd
 | 
					 | 
				
			||||||
    exit
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
usermod --help | grep -q -- '-A group' && echo true || echo false
 | 
					usermod --help | grep -q -- '-A group' && echo true || echo false
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,19 +23,6 @@ state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
oldusermod="$(cat "$__object/explorer/oldusermod")"
 | 
					oldusermod="$(cat "$__object/explorer/oldusermod")"
 | 
				
			||||||
os=$(cat "$__global/explorer/os")
 | 
					os=$(cat "$__global/explorer/os")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$os" = "netbsd" ]; then
 | 
					 | 
				
			||||||
	# NetBSD does not have a command to remove a user from a group
 | 
					 | 
				
			||||||
	oldusermod="true"
 | 
					 | 
				
			||||||
	addparam="-G"
 | 
					 | 
				
			||||||
	delparam=";;#"
 | 
					 | 
				
			||||||
elif [ "$oldusermod" = "true" ]; then
 | 
					 | 
				
			||||||
        addparam="-A"
 | 
					 | 
				
			||||||
        delparam="-R"
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
        addparam="-a"
 | 
					 | 
				
			||||||
        delparam="-d"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
mkdir "$__object/files"
 | 
					mkdir "$__object/files"
 | 
				
			||||||
# file has to be sorted for comparison with `comm`
 | 
					# file has to be sorted for comparison with `comm`
 | 
				
			||||||
sort "$__object/parameter/group" > "$__object/files/group.sorted"
 | 
					sort "$__object/parameter/group" > "$__object/files/group.sorted"
 | 
				
			||||||
| 
						 | 
					@ -43,11 +30,9 @@ sort "$__object/parameter/group" > "$__object/files/group.sorted"
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
   present)
 | 
					   present)
 | 
				
			||||||
      changed_groups="$(comm -13 "$__object/explorer/group" "$__object/files/group.sorted")"
 | 
					      changed_groups="$(comm -13 "$__object/explorer/group" "$__object/files/group.sorted")"
 | 
				
			||||||
      action="$addparam"
 | 
					 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
   absent)
 | 
					   absent)
 | 
				
			||||||
      changed_groups="$(comm -12 "$__object/explorer/group" "$__object/files/group.sorted")"
 | 
					      changed_groups="$(comm -12 "$__object/explorer/group" "$__object/files/group.sorted")"
 | 
				
			||||||
      action="$delparam"
 | 
					 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,9 +42,25 @@ if [ -z "$changed_groups" ]; then
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for group in $changed_groups; do
 | 
					for group in $changed_groups; do
 | 
				
			||||||
   if [ "$oldusermod" = "true" ]; then
 | 
					   if [ "$os" = "netbsd" ]; then
 | 
				
			||||||
     echo "usermod $action \"$group\" \"$user\""
 | 
					      case "$state_should" in
 | 
				
			||||||
 | 
					         present) echo "usermod -G \"$group\" \"$user\"" ;;
 | 
				
			||||||
 | 
					         absent) echo 'NetBSD does not have a command to remove a user from a group' >&2 ; exit 1 ;;
 | 
				
			||||||
 | 
					      esac
 | 
				
			||||||
 | 
					   elif [ "$os" = "freebsd" ]; then
 | 
				
			||||||
 | 
					      case "$state_should" in
 | 
				
			||||||
 | 
					         present) echo "pw groupmod \"$group\" -m \"$user\"" ;;
 | 
				
			||||||
 | 
					         absent) echo "pw groupmod \"$group\" -d \"$user\"" ;;
 | 
				
			||||||
 | 
					      esac
 | 
				
			||||||
 | 
					   elif [ "$oldusermod" = "true" ]; then
 | 
				
			||||||
 | 
					      case "$state_should" in
 | 
				
			||||||
 | 
					         present) echo "usermod -A \"$group\" \"$user\"" ;;
 | 
				
			||||||
 | 
					         absent) echo "usermod -R \"$group\" \"$user\"" ;;
 | 
				
			||||||
 | 
					      esac
 | 
				
			||||||
   else
 | 
					   else
 | 
				
			||||||
     echo "gpasswd $action \"$user\" \"$group\""
 | 
					      case "$state_should" in
 | 
				
			||||||
 | 
					         present) echo "gpasswd -a \"$group\" \"$user\"" ;;
 | 
				
			||||||
 | 
					         absent) echo "gpasswd -d \"$group\" \"$user\"" ;;
 | 
				
			||||||
 | 
					      esac
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,6 +29,8 @@ import tempfile
 | 
				
			||||||
import socket
 | 
					import socket
 | 
				
			||||||
import multiprocessing
 | 
					import multiprocessing
 | 
				
			||||||
from cdist.mputil import mp_pool_run
 | 
					from cdist.mputil import mp_pool_run
 | 
				
			||||||
 | 
					import atexit
 | 
				
			||||||
 | 
					import shutil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import cdist
 | 
					import cdist
 | 
				
			||||||
import cdist.hostsource
 | 
					import cdist.hostsource
 | 
				
			||||||
| 
						 | 
					@ -94,7 +96,6 @@ class Config(object):
 | 
				
			||||||
                                   "failed: %s" % e))
 | 
					                                   "failed: %s" % e))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            args.manifest = initial_manifest_temp_path
 | 
					            args.manifest = initial_manifest_temp_path
 | 
				
			||||||
            import atexit
 | 
					 | 
				
			||||||
            atexit.register(lambda: os.remove(initial_manifest_temp_path))
 | 
					            atexit.register(lambda: os.remove(initial_manifest_temp_path))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # default remote cmd patterns
 | 
					        # default remote cmd patterns
 | 
				
			||||||
| 
						 | 
					@ -177,8 +178,15 @@ class Config(object):
 | 
				
			||||||
                              " ".join(failed_hosts))
 | 
					                              " ".join(failed_hosts))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def _resolve_remote_cmds(cls, args, host_base_path):
 | 
					    def _resolve_ssh_control_path(cls):
 | 
				
			||||||
        control_path = os.path.join(host_base_path, "ssh-control-path")
 | 
					        base_path = tempfile.mkdtemp()
 | 
				
			||||||
 | 
					        control_path = os.path.join(base_path, "s")
 | 
				
			||||||
 | 
					        atexit.register(lambda: shutil.rmtree(base_path))
 | 
				
			||||||
 | 
					        return control_path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @classmethod
 | 
				
			||||||
 | 
					    def _resolve_remote_cmds(cls, args):
 | 
				
			||||||
 | 
					        control_path = cls._resolve_ssh_control_path()
 | 
				
			||||||
        # If we constructed patterns for remote commands then there is
 | 
					        # If we constructed patterns for remote commands then there is
 | 
				
			||||||
        # placeholder for ssh ControlPath, format it and we have unique
 | 
					        # placeholder for ssh ControlPath, format it and we have unique
 | 
				
			||||||
        # ControlPath for each host.
 | 
					        # ControlPath for each host.
 | 
				
			||||||
| 
						 | 
					@ -201,8 +209,7 @@ class Config(object):
 | 
				
			||||||
        log = logging.getLogger(host)
 | 
					        log = logging.getLogger(host)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            remote_exec, remote_copy = cls._resolve_remote_cmds(
 | 
					            remote_exec, remote_copy = cls._resolve_remote_cmds(args)
 | 
				
			||||||
                args, host_base_path)
 | 
					 | 
				
			||||||
            log.debug("remote_exec for host \"{}\": {}".format(
 | 
					            log.debug("remote_exec for host \"{}\": {}".format(
 | 
				
			||||||
                host, remote_exec))
 | 
					                host, remote_exec))
 | 
				
			||||||
            log.debug("remote_copy for host \"{}\": {}".format(
 | 
					            log.debug("remote_copy for host \"{}\": {}".format(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -153,7 +153,8 @@ class Manifest(object):
 | 
				
			||||||
        message_prefix = "initialmanifest"
 | 
					        message_prefix = "initialmanifest"
 | 
				
			||||||
        self.local.run_script(initial_manifest,
 | 
					        self.local.run_script(initial_manifest,
 | 
				
			||||||
                              env=self.env_initial_manifest(initial_manifest),
 | 
					                              env=self.env_initial_manifest(initial_manifest),
 | 
				
			||||||
                              message_prefix=message_prefix)
 | 
					                              message_prefix=message_prefix,
 | 
				
			||||||
 | 
					                              save_output=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def env_type_manifest(self, cdist_object):
 | 
					    def env_type_manifest(self, cdist_object):
 | 
				
			||||||
        type_manifest = os.path.join(self.local.type_path,
 | 
					        type_manifest = os.path.join(self.local.type_path,
 | 
				
			||||||
| 
						 | 
					@ -178,4 +179,5 @@ class Manifest(object):
 | 
				
			||||||
        if os.path.isfile(type_manifest):
 | 
					        if os.path.isfile(type_manifest):
 | 
				
			||||||
            self.local.run_script(type_manifest,
 | 
					            self.local.run_script(type_manifest,
 | 
				
			||||||
                                  env=self.env_type_manifest(cdist_object),
 | 
					                                  env=self.env_type_manifest(cdist_object),
 | 
				
			||||||
                                  message_prefix=message_prefix)
 | 
					                                  message_prefix=message_prefix,
 | 
				
			||||||
 | 
					                                  save_output=False)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,6 +149,7 @@ class Local(object):
 | 
				
			||||||
        self.mkdir(self.global_explorer_out_path)
 | 
					        self.mkdir(self.global_explorer_out_path)
 | 
				
			||||||
        self.mkdir(self.object_path)
 | 
					        self.mkdir(self.object_path)
 | 
				
			||||||
        self.mkdir(self.bin_path)
 | 
					        self.mkdir(self.bin_path)
 | 
				
			||||||
 | 
					        self.mkdir(self.cache_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def create_files_dirs(self):
 | 
					    def create_files_dirs(self):
 | 
				
			||||||
        self._init_directories()
 | 
					        self._init_directories()
 | 
				
			||||||
| 
						 | 
					@ -231,7 +232,7 @@ class Local(object):
 | 
				
			||||||
                message.merge_messages()
 | 
					                message.merge_messages()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def run_script(self, script, env=None, return_output=False,
 | 
					    def run_script(self, script, env=None, return_output=False,
 | 
				
			||||||
                   message_prefix=None):
 | 
					                   message_prefix=None, save_output=True):
 | 
				
			||||||
        """Run the given script with the given environment.
 | 
					        """Run the given script with the given environment.
 | 
				
			||||||
        Return the output as a string.
 | 
					        Return the output as a string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -240,7 +241,7 @@ class Local(object):
 | 
				
			||||||
        command.append(script)
 | 
					        command.append(script)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return self.run(command=command, env=env, return_output=return_output,
 | 
					        return self.run(command=command, env=env, return_output=return_output,
 | 
				
			||||||
                        message_prefix=message_prefix)
 | 
					                        message_prefix=message_prefix, save_output=save_output)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def save_cache(self):
 | 
					    def save_cache(self):
 | 
				
			||||||
        destination = os.path.join(self.cache_path, self.hostdir)
 | 
					        destination = os.path.join(self.cache_path, self.hostdir)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ def inspect_ssh_mux_opts():
 | 
				
			||||||
    wanted_mux_opts = {
 | 
					    wanted_mux_opts = {
 | 
				
			||||||
        "ControlPath": "{}",
 | 
					        "ControlPath": "{}",
 | 
				
			||||||
        "ControlMaster": "auto",
 | 
					        "ControlMaster": "auto",
 | 
				
			||||||
        "ControlPersist": "125",
 | 
					        "ControlPersist": "10",
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    mux_opts = " ".join([" -o {}={}".format(
 | 
					    mux_opts = " ".join([" -o {}={}".format(
 | 
				
			||||||
        x, wanted_mux_opts[x]) for x in wanted_mux_opts])
 | 
					        x, wanted_mux_opts[x]) for x in wanted_mux_opts])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,30 @@ Changelog
 | 
				
			||||||
---------
 | 
					---------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
next:
 | 
					next:
 | 
				
			||||||
 | 
						* Type __golang_from_vendor: Install golang from https://golang.org/dl/ (Kamila Součková)
 | 
				
			||||||
 | 
						* Type __go_get: Install go packages using go get (Kamila Součková)
 | 
				
			||||||
 | 
						* Explorer kernel_name: uname -s (Kamila Součková)
 | 
				
			||||||
 | 
						* Type __sysctl: Add devuan support (Nico Schottelius)
 | 
				
			||||||
 | 
						* Type __start_on_boot: Add devuan support (Nico Schottelius)
 | 
				
			||||||
 | 
						* Core: Shorten ssh control path (Darko Poljak)
 | 
				
			||||||
 | 
						* Type __consul: Add new version and add http check (Kamila Součková)
 | 
				
			||||||
 | 
						* New types: __daemontools and __daemontools_service (Kamila Součková)
 | 
				
			||||||
 | 
						* New types: __prometheus_server and __prometheus_alertmanager (Kamila Součková)
 | 
				
			||||||
 | 
						* New type: __grafana_dashboard (Kamila Součková)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					4.4.2: 2017-03-08
 | 
				
			||||||
 | 
						* Core: Fix suppression of manifests' outputs (Darko Poljak)
 | 
				
			||||||
 | 
						* Type __user_groups: Support FreeBSD (Andres Erbsen)
 | 
				
			||||||
 | 
						* Type __cron: Fix filter for new cron on sles12 sp2 (Daniel Heule)
 | 
				
			||||||
 | 
						* Type __docker: Support absent state (Dominique Roux)
 | 
				
			||||||
 | 
						* Type __docker_compose: Support absent state (Dominique Roux)
 | 
				
			||||||
 | 
						* New type: __hosts (Dmitry Bogatov)
 | 
				
			||||||
 | 
						* New type: __dot_file (Dmitry Bogatov)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					4.4.1: 2016-12-17
 | 
				
			||||||
 | 
						* Documentation: Update docs for types that used man.rst as symbolic links (Darko Poljak)
 | 
				
			||||||
 | 
						* Type __cron: Remove '# marker' for raw_command due to cron security (Daniel Heule)
 | 
				
			||||||
 | 
						* New type: __docker_compose (Dominique Roux)
 | 
				
			||||||
	* Type __apt_mark: Check supported apt version and if package is installed (Ander Punnar)
 | 
						* Type __apt_mark: Check supported apt version and if package is installed (Ander Punnar)
 | 
				
			||||||
	* New type: __docker (Steven Armstrong)
 | 
						* New type: __docker (Steven Armstrong)
 | 
				
			||||||
	* New type: __package_dpkg (Tomas Pospisek)
 | 
						* New type: __package_dpkg (Tomas Pospisek)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								docs/dev/logs/2017-04-27.execution-order.org
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/dev/logs/2017-04-27.execution-order.org
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					* After constructs don't exist
 | 
				
			||||||
 | 
					  Flow as implemented on 2013-04-12 has the problem of not allowing
 | 
				
			||||||
 | 
					  *after* constructs.
 | 
				
			||||||
 | 
					* "Type explorer & manifests only" is broken
 | 
				
			||||||
 | 
					  Doesn't catch external dependencies
 | 
				
			||||||
| 
						 | 
					@ -51,6 +51,19 @@ Example:
 | 
				
			||||||
    __myfancysingleton --colour green
 | 
					    __myfancysingleton --colour green
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Config types
 | 
				
			||||||
 | 
					------------
 | 
				
			||||||
 | 
					By default types are used with config command. These are types that are not
 | 
				
			||||||
 | 
					flagged by any known command flag. If a type is marked then it will be skipped
 | 
				
			||||||
 | 
					with config command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Install types
 | 
				
			||||||
 | 
					-------------
 | 
				
			||||||
 | 
					If a type is flagged with 'install' flag then it is used only with install command.
 | 
				
			||||||
 | 
					With other commands, i.e. config, these types are skipped if used.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
How to write a new type
 | 
					How to write a new type
 | 
				
			||||||
-----------------------
 | 
					-----------------------
 | 
				
			||||||
A type consists of
 | 
					A type consists of
 | 
				
			||||||
| 
						 | 
					@ -209,6 +222,18 @@ As you can see, the object ID is omitted, because it does not make any sense,
 | 
				
			||||||
if your type can be used only once.
 | 
					if your type can be used only once.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Install - type with install command
 | 
				
			||||||
 | 
					-----------------------------------
 | 
				
			||||||
 | 
					If you want a type to be used with install command, you must mark it as
 | 
				
			||||||
 | 
					install: create the (empty) file "install" in your type directory:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    touch cdist/conf/type/__install_NAME/install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					With other commands, i.e. config, it will be skipped if used.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The type explorers
 | 
					The type explorers
 | 
				
			||||||
------------------
 | 
					------------------
 | 
				
			||||||
If a type needs to explore specific details, it can provide type specific
 | 
					If a type needs to explore specific details, it can provide type specific
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue