Commit 552860b9 authored by tom@it-eckert.de's avatar tom@it-eckert.de

add parameters for ownership and generic rsync-options (__xymon_config)

parent 0bc00477
......@@ -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
-------
......
......@@ -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" \
$@
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment