forked from ungleich-public/cdist
Merge branch 'master' into preos
This commit is contained in:
commit
7988b3f8b9
11 changed files with 199 additions and 4 deletions
4
Makefile
4
Makefile
|
@ -175,10 +175,12 @@ freecode-release: $(FREECODE_FILE)
|
||||||
################################################################################
|
################################################################################
|
||||||
# pypi
|
# pypi
|
||||||
#
|
#
|
||||||
pypi-release: man $(PYTHON_VERSION)
|
PYPI_FILE=.pypi-release
|
||||||
|
$(PYPI_FILE): man $(PYTHON_VERSION)
|
||||||
python3 setup.py sdist upload
|
python3 setup.py sdist upload
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
pypi-release: $(PYPI_FILE)
|
||||||
################################################################################
|
################################################################################
|
||||||
# archlinux
|
# archlinux
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2010-2014 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
|
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
|
@ -20,6 +20,6 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
if command -v hostname >/dev/null; then
|
if command -v uname >/dev/null; then
|
||||||
hostname -f
|
uname -n
|
||||||
fi
|
fi
|
||||||
|
|
24
cdist/conf/type/__hostname/explorer/has_hostnamectl
Executable file
24
cdist/conf/type/__hostname/explorer/has_hostnamectl
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2014 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Check whether system has hostnamectl
|
||||||
|
#
|
||||||
|
|
||||||
|
command -v hostnamectl || true
|
26
cdist/conf/type/__hostname/explorer/hostname_file
Executable file
26
cdist/conf/type/__hostname/explorer/hostname_file
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2014 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Retrieve the contents of /etc/hostname
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f /etc/hostname ]; then
|
||||||
|
cat /etc/hostname
|
||||||
|
fi
|
50
cdist/conf/type/__hostname/gencode-remote
Executable file
50
cdist/conf/type/__hostname/gencode-remote
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
# 2014 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/name" ]; then
|
||||||
|
name_should="$(cat "$__object/parameter/name")"
|
||||||
|
else
|
||||||
|
name_should="$(echo "${__target_host%%.*}")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
os=$(cat "$__global/explorer/os")
|
||||||
|
name_running=$(cat "$__global/explorer/hostname")
|
||||||
|
name_config=$(cat "$__object/explorer/hostname_file")
|
||||||
|
has_hostnamectl=$(cat "$__object/explorer/has_hostnamectl")
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# If everything is ok -> exit
|
||||||
|
#
|
||||||
|
if [ "$name_config" = "$name_should" -a "$name_running" = "$name_should" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Setup hostname
|
||||||
|
#
|
||||||
|
echo changed >> "$__messages_out"
|
||||||
|
|
||||||
|
if [ "$has_hostnamectl" ]; then
|
||||||
|
echo "hostnamectl set-hostname '$name_should'"
|
||||||
|
else
|
||||||
|
echo "hostname '$name_should'"
|
||||||
|
echo "printf '%s\n' '$name_should' > /etc/hostname"
|
||||||
|
fi
|
52
cdist/conf/type/__hostname/man.text
Normal file
52
cdist/conf/type/__hostname/man.text
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
cdist-type__hostname(7)
|
||||||
|
=======================
|
||||||
|
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__hostname - set the hostname
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
Set's the hostname on various operating systems.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
None.
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
name::
|
||||||
|
The hostname to set. Defaults to the first segment of __target_host
|
||||||
|
(${__target_host%%.*})
|
||||||
|
|
||||||
|
|
||||||
|
MESSAGES
|
||||||
|
--------
|
||||||
|
changed::
|
||||||
|
Changed the hostname
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
# take hostname from __target_host
|
||||||
|
__hostname
|
||||||
|
|
||||||
|
# set hostname explicitly
|
||||||
|
__hostname --name some-static-hostname
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
Copyright \(C) 2012 Steven Armstrong. Free use of this software is
|
||||||
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
38
cdist/conf/type/__hostname/manifest
Executable file
38
cdist/conf/type/__hostname/manifest
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
# 2014 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
|
not_supported() {
|
||||||
|
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
||||||
|
echo "Please contribute an implementation for it if you can." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$os" in
|
||||||
|
archlinux|debian|ubuntu)
|
||||||
|
# handled in gencode-remote
|
||||||
|
:
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
not_supported
|
||||||
|
;;
|
||||||
|
esac
|
1
cdist/conf/type/__hostname/parameter/optional
Normal file
1
cdist/conf/type/__hostname/parameter/optional
Normal file
|
@ -0,0 +1 @@
|
||||||
|
name
|
0
cdist/conf/type/__hostname/singleton
Normal file
0
cdist/conf/type/__hostname/singleton
Normal file
|
@ -6,6 +6,8 @@ Changelog
|
||||||
|
|
||||||
3.0.3:
|
3.0.3:
|
||||||
* Core: Enhance error message when requirement is missing object id
|
* Core: Enhance error message when requirement is missing object id
|
||||||
|
* Explorer hostname: Return host name by using uname -n
|
||||||
|
* New Type: __hostname (Steven Armstrong)
|
||||||
|
|
||||||
3.0.2: 2014-01-19
|
3.0.2: 2014-01-19
|
||||||
* Documentation: Document all messages sent by types (Daniel Heule)
|
* Documentation: Document all messages sent by types (Daniel Heule)
|
||||||
|
|
BIN
docs/gfx/cdist-logo-1024-scaled.png
Normal file
BIN
docs/gfx/cdist-logo-1024-scaled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in a new issue