Compare commits

...

9 commits
6.1 ... master

Author SHA1 Message Date
Daniel Tschada
98b44739e8 add new type __podan_compose 2019-12-03 18:40:52 +01:00
Darko Poljak
b8c6f8c8f5 ++changelog 2019-11-21 17:01:27 +01:00
8efd2681db Merge branch '__apt_key_mktemp_gpghome' into 'master'
__apt_key: use mktemp for unique temporary gpg home

See merge request ungleich-public/cdist!812
2019-11-21 17:01:10 +01:00
01bd01573e __apt_key: use mktemp for unique temporary gpg home 2019-11-21 14:15:51 +02:00
Darko Poljak
ac2463fe31 ++changelog 2019-11-20 20:58:42 +01:00
96ffb4fd02 Merge branch 'xymon_client-msgcache' into 'master'
add `--msgcache`-parameter to support passive clients (__xymon_client)

See merge request ungleich-public/cdist!811
2019-11-20 20:59:10 +01:00
37ee988d1f Merge branch 'xymon_config-excludes' into 'master'
add parameters for ownership and generic rsync-options (__xymon_config)

See merge request ungleich-public/cdist!810
2019-11-20 20:57:31 +01:00
552860b9cd add parameters for ownership and generic rsync-options (__xymon_config) 2019-11-20 15:49:25 +01:00
34bd96db4b add --msgcache-parameter to support passive clients (__xymon_client)
Fix a typo along the way, too.
2019-11-20 15:47:25 +01:00
18 changed files with 217 additions and 13 deletions

View file

@ -61,31 +61,29 @@ EOF
echo "curl -s -L '$uri' | apt-key add -"
fi
elif [ -d "$keydir" ]; then
tmp='/tmp/cdist_apt_key_tmp'
# we need to kill gpg after 30 seconds, because gpg
# can get stuck if keyserver is not responding.
# exporting env var and not exit 1,
# because we need to clean up and kill dirmngr.
cat << EOF
mkdir -m 700 -p "$tmp"
gpgtmphome="\$( mktemp -d )"
if timeout 30s \\
gpg --homedir "$tmp" \\
gpg --homedir "\$gpgtmphome" \\
--keyserver "$keyserver" \\
--recv-keys "$keyid"
then
gpg --homedir "$tmp" \\
gpg --homedir "\$gpgtmphome" \\
--export "$keyid" \\
> "$keyfile"
else
export GPG_GOT_STUCK=1
fi
GNUPGHOME="$tmp" gpgconf --kill dirmngr
GNUPGHOME="\$gpgtmphome" gpgconf --kill dirmngr
rm -rf "$tmp"
rm -rf "\$gpgtmphome"
if [ -n "\$GPG_GOT_STUCK" ]
then

View file

@ -0,0 +1,24 @@
#!/bin/sh -e
#
# 2019 Daniel Tschada
#
# 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/>.
#
install="$(cat "$__object/parameter/install")"
state="$(cat "$__object/parameter/state")"
user="$(cat "$__object/parameter/user")"
version="$(cat "$__object/parameter/version")"

View file

@ -0,0 +1,61 @@
cdist-type__podman_compose(7)
=============================
NAME
----
cdist-type__podman_compose - install podman-compose
DESCRIPTION
-----------
Installs podman-compose package.
State 'absent' will not remove podman binary itself,
only podman-compose binary will be removed
REQUIRED PARAMETERS
-------------------
install
defaults to 'pip'
OPTIONAL PARAMETERS
-------------------
state
'present' or 'absent', defaults to 'present'
user
the user who owns the file, defaults to 'root'
BOOLEAN PARAMETERS
------------------
None.
EXAMPLES
--------
.. code-block:: sh
# Install podman-compose
__podman_compose
# Install latest version via pip
__podman_compose --state present --install pip
# Install latest version via pip and change user
__podman_compose --state present --install pip --user root
# Remove podman-compose
__podman_compose --state absent
AUTHORS
-------
Daniel Tschada <mail--@--moep.name>
COPYING
-------
Copyright \(C) 2019 Daniel Tschada. Free use of this software is
granted under the terms of the GNU General Public License version 3 or later (GPLv3+).

View file

@ -0,0 +1,50 @@
#!/bin/sh -e
#
# 2019 Daniel Tschada
#
# 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/>.
#
# shellcheck disable=SC2154
# shellcheck disable=SC2034
install="$(cat "$__object/parameter/install")"
state="$(cat "$__object/parameter/state")"
user="$(cat "$__object/parameter/user")"
version="$(cat "$__object/parameter/version")"
# install it with pip
if [ "${install}" = "pip" ]; then
if [ "${state}" = "present" ]; then
__package_pip podman-compose --state present --pip /usr/local/bin/podman-compose --runas "${user}"
elif [ "${state}" = "absent" ]; then
__package_pip podman-compose --state absent
else
if [ "${state}" != "present" ] -a [ "${state}" != "absent" ]; then
echo "Unknown state: ${state}" >&2
exit 1
else
echo "Unknown user: ${user}" >&2
exit 1
fi
fi
else
echo "Unknown user: ${install}" >&2
exit 1
fi

View file

@ -0,0 +1 @@
pip

View file

@ -0,0 +1 @@
present

View file

@ -0,0 +1 @@
root

View file

@ -0,0 +1,4 @@
install
state
user
version

View file

@ -0,0 +1 @@
install

View file

@ -27,21 +27,30 @@ servers
to. While DNS-names are ok it is discouraged, defaults to 127.0.0.1.
BOOLEAN PARAMETERS
------------------
msgcache
Enable xymon `msgcache`. Note: XYMONSERVER has to be `127.0.0.1` for using
`msgcache` (see `msgcache (8)` of the xymon documentation for details).
EXAMPLES
--------
.. code-block:: sh
# minmal, report to 127.0.0.1
# minimal, report to 127.0.0.1
__xymon_client
# specify server:
__xymon_client --servers "192.168.1.1"
# activate `msgcache` for passive client:
__xymon_client --msgcache
SEE ALSO
--------
:strong:`cdist__xymon_server`\ (7), :strong:`xymon`\ (7)
:strong:`cdist__xymon_server`\ (7), :strong:`xymon`\ (7), :strong:`msgcache`\ (8)
AUTHORS

View file

@ -34,6 +34,11 @@ esac
__package xymon-client --state "$state"
if [ -f "$__object/parameter/msgcache" ]; then
require="__package/xymon-client" __line /etc/xymon/clientlaunch.cfg \
--regex DISABLED --state absent
fi
require="__package/xymon-client" __key_value CLIENTHOSTNAME \
--file /etc/default/xymon-client \
--value "'$__target_hostname'" \

View file

@ -0,0 +1 @@
msgcache

View file

@ -23,6 +23,21 @@ confdir
deployed.
OPTIONAL PARAMETERS
-------------------
owner
passed as-is as `--owner` to `__rsync`
group
passed as-is as `--group` to `__rsync`
OPTIONAL MULTIPLE PARAMETERS
----------------------------
rsync-opts
identical to __rsync type, only `--`-options are supported
REQUIRED FILES
--------------
The directory specified by `confdir` has to contain a valid xymon-configuration
@ -39,10 +54,16 @@ EXAMPLES
# this will replace /etc/xymon/ on the target host with
# the contents from __xymon_config/files/xymon.example.com/
## the same but set ownership to `xymon:xymon` and exclude
## the `netrc`-file:
__xymon_config --confdir=xymon.example.com \
--owner xymon --group xymon \
--rsync-opts "exclude=netrc"
SEE ALSO
--------
:strong:`cdist__xymon_server`\ (7), :strong:`xymon`\ (7)
:strong:`cdist__xymon_server`\ (7), :strong:`cdist__rsync`\ (7), :strong:`xymon`\ (7)
AUTHORS
-------

View file

@ -18,7 +18,26 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
confdir=$(cat "$__object/parameter/confdir")
set --
if [ -f "$__object/parameter/owner" ]; then
owner=$(cat "$__object/parameter/owner")
set -- "$@" "--owner $owner"
fi
if [ -f "$__object/parameter/group" ]; then
group=$(cat "$__object/parameter/group")
set -- "$@" "--group $group"
fi
## pass `--rsync-opts` as-is to `__rsync`:
if [ -f "$__object/parameter/rsync-opts" ]; then
while read -r opts; do
# shellcheck disable=SC2089
set -- "$@" "--rsync-opts '$opts'"
done < "$__object/parameter/rsync-opts"
fi
# shellcheck disable=SC2068,SC2090
__rsync /etc/xymon/ \
--source "$__type/files/$confdir/" \
--rsync-opts "delete"
--rsync-opts "delete" \
$@

View file

@ -0,0 +1,2 @@
owner
group

View file

@ -0,0 +1 @@
rsync-opts

View file

@ -1,6 +1,11 @@
Changelog
---------
next:
* Type __xymon_config: Add parameters for ownership and generic rsync options (Thomas Eckert)
* Type __xymon_client: Add msgcache parameter to support passive clients (Thomas Eckert)
* Type __apt_key: Use mktemp for unique temporary gpg home (Ander Punnar)
6.1.0: 2019-11-19
* Explorer hostname, type __hostname: Support more operating systems, rewrite type and hostname explorer (Dennis Camera)