From 27fd9cd61be398d9cabe14ee09ee66a73d89a381 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 16:05:47 +0200 Subject: [PATCH] add sudo example Signed-off-by: Nico Schottelius --- other/examples/types/__nico_sudo/README | 2 ++ .../types/__nico_sudo/files/sudo-nico | 13 ++++++++ other/examples/types/__nico_sudo/manifest | 30 ++++++++++++++++++ .../types/__nico_sudo/parameter/gencode | 31 +++++++++++++++++++ .../types/__nico_sudo/parameter/manifest | 31 +++++++++++++++++++ .../types/__nico_sudo/parameter/optional | 0 .../types/__nico_sudo/parameter/required | 0 other/examples/types/__nico_sudo/singleton | 0 8 files changed, 107 insertions(+) create mode 100644 other/examples/types/__nico_sudo/README create mode 100644 other/examples/types/__nico_sudo/files/sudo-nico create mode 100755 other/examples/types/__nico_sudo/manifest create mode 100644 other/examples/types/__nico_sudo/parameter/gencode create mode 100644 other/examples/types/__nico_sudo/parameter/manifest create mode 100644 other/examples/types/__nico_sudo/parameter/optional create mode 100644 other/examples/types/__nico_sudo/parameter/required create mode 100644 other/examples/types/__nico_sudo/singleton diff --git a/other/examples/types/__nico_sudo/README b/other/examples/types/__nico_sudo/README new file mode 100644 index 00000000..5e4cf0d3 --- /dev/null +++ b/other/examples/types/__nico_sudo/README @@ -0,0 +1,2 @@ +Configure sudoers file to be included. Different types may do so, +this one simply uses the "nico" file to store the configuration. diff --git a/other/examples/types/__nico_sudo/files/sudo-nico b/other/examples/types/__nico_sudo/files/sudo-nico new file mode 100644 index 00000000..d904c319 --- /dev/null +++ b/other/examples/types/__nico_sudo/files/sudo-nico @@ -0,0 +1,13 @@ +# +# Cdist managed file +# + +# Personal one: nico, shared one: lyni +User_Alias NICO = nico, lyni + +Defaults timestamp_timeout=5 +Defaults !tty_tickets + +# Give out permissions +NICO ALL=(ALL) ALL +NICO ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend diff --git a/other/examples/types/__nico_sudo/manifest b/other/examples/types/__nico_sudo/manifest new file mode 100755 index 00000000..5de33973 --- /dev/null +++ b/other/examples/types/__nico_sudo/manifest @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +destination=/etc/sudoers.d/nico +source="$__type/files/sudo-nico" + +__package sudo --state installed +__directory /etc/sudoers.d --parents yes + +require="__directory/etc/sudoers.d" \ + __file "$destination" --source "$source" --mode 0440 + diff --git a/other/examples/types/__nico_sudo/parameter/gencode b/other/examples/types/__nico_sudo/parameter/gencode new file mode 100644 index 00000000..74792abf --- /dev/null +++ b/other/examples/types/__nico_sudo/parameter/gencode @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# USEFUL DESCRIPTION +# + +# +# This file should generate code on stdout, which will be collected by cdist +# and run on the target. +# +# To tell cdist to make use of it, you need to make it executable (chmod +x) +# +# + diff --git a/other/examples/types/__nico_sudo/parameter/manifest b/other/examples/types/__nico_sudo/parameter/manifest new file mode 100644 index 00000000..c696eda6 --- /dev/null +++ b/other/examples/types/__nico_sudo/parameter/manifest @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# USEFUL DESCRIPTION +# + +# +# This is the manifest, which can be used to create other objects like this: +# __file /path/to/destination --source /from/where/ +# +# To tell cdist to make use of it, you need to make it executable (chmod +x) +# +# + diff --git a/other/examples/types/__nico_sudo/parameter/optional b/other/examples/types/__nico_sudo/parameter/optional new file mode 100644 index 00000000..e69de29b diff --git a/other/examples/types/__nico_sudo/parameter/required b/other/examples/types/__nico_sudo/parameter/required new file mode 100644 index 00000000..e69de29b diff --git a/other/examples/types/__nico_sudo/singleton b/other/examples/types/__nico_sudo/singleton new file mode 100644 index 00000000..e69de29b