Commit graph

2204 commits

Author SHA1 Message Date
Steven Armstrong
831bfc822b remove unused code
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-06-13 13:44:01 +02:00
Steven Armstrong
6e9e9ad557 implement log server to capture nested logging output
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-06-13 13:44:01 +02:00
Darko Poljak
4167f9f60c Use proper format string with name 2020-06-11 14:22:54 +02:00
Darko Poljak
840e417eb7 Fix emulator colored logging 2020-06-11 14:16:37 +02:00
7c490a703d [__clean_path] add --path parameter 2020-06-10 11:38:14 +03:00
Darko Poljak
a251e53495 Merge branch 'fix_os_explorer_sles15' of https://github.com/dheule/cdist into dheule-fix_os_explorer_sles15 2020-06-08 13:43:41 +02:00
Dennis Camera
23e66e08fa Restrict colored_output value to always/never/auto. 2020-06-06 13:45:31 +02:00
Dennis Camera
89e48734bf Let config file and command line override NO_COLOR envvar 2020-06-05 12:23:36 +02:00
Dennis Camera
cdb0d2be41 Patch tests 2020-06-03 23:21:50 +02:00
Dennis Camera
747c6b1076 Respect NO_COLOR environment variable 2020-06-03 22:17:52 +02:00
Daniel Heule
6a611e556a fix os explorer for sles15 2020-06-02 13:40:21 +02:00
Darko Poljak
55ebd1a4c5 Fix man build failure in newer sphinx versions 2020-06-01 20:22:40 +02:00
ba77ea9edc [UX] Add option to enable LogLevel-based coloured output.
This makes it easier for new and experienced users to run cdist with higher
verbosity levels, both to know that things are working as expected and to debug
issues.

Documentation has been modified accordingly and default behaviour is not
changed.
2020-06-01 19:11:58 +02:00
Darko Poljak
988190363a Resolve shellcheck SC1090 2020-05-30 15:10:13 +02:00
29c0180204 [__ssh_authorized_keys] add --remove-unknown parameter 2020-05-28 23:31:13 +03:00
Darko Poljak
f4e1bbc87e Fix multiple log lines
Fixes #813.
2020-05-24 01:10:56 +02:00
716d3554f3 [__user] fix user delete on freebsd 2020-05-23 00:48:35 +03:00
dab32b0cb6 Merge branch '__group_freebsd_fix' into 'master'
[__group] fix --gid on freebsd

See merge request ungleich-public/cdist!881
2020-05-22 10:08:29 +02:00
3bcbd95269 [__motd] debian|ubuntu|devuan use /etc/motd 2020-05-22 02:36:49 +03:00
bf25a18a04 [__group] fix --gid on freebsd 2020-05-22 02:31:38 +03:00
ad58ea79c2 [__ssh_authorized_keys] Fix bug where --option was not multiple
This went against both documentation and intent.
2020-05-18 20:01:01 +02:00
8d639d54d0 Merge branch 'evilham-authorized_keys-man' into 'master'
[__ssh_authorizedkey{,s}] Improve documentation.

See merge request ungleich-public/cdist!877
2020-05-18 19:49:50 +02:00
2362d89976 Merge branch 'evilham-machine_type-explorer-simplify-linux-add-openbsd' into 'master'
[explorer/machine_type] simplify linux add openbsd

See merge request ungleich-public/cdist!876
2020-05-18 19:48:47 +02:00
c5454afc72 Merge branch 'evilham-machine_type-explorer-freebsd' into 'master'
[explorer/machine_type] Add support for FreeBSD.

See merge request ungleich-public/cdist!875
2020-05-18 19:46:47 +02:00
6d502f737a [__ssh_authorizedkey{,s}] Improve documentation. 2020-05-18 18:37:16 +02:00
8b790b0a54 [explorer/machine_type] Make shellcheck happy! 2020-05-18 16:47:20 +02:00
cf44c4a01b [explorer/machine_type] Simplify Linux + basic OpenBSD support.
By abstracting away vendor-dependent pattern matching for the linux code, we can
re-use that and be reasonably sure about OpenBSD machines being virtualised when
we can identify the undelrying virtualisation technology.
It remains to be solved how to tell if an OpenBSD machine is physical; in that
case previous cdist behaviour ("unknown") remains.

For NetBSD something similar to OpenBSD could be done, with different sysctls:
hw.machine and hw.model wary of adding those without testing though, so for
NetBSD previous cdist behaviour ("unknown") remains.
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7.i386+NetBSD-9.0
2020-05-18 16:35:50 +02:00
7ca2bfc14a [explorer/machine_type] Add support for FreeBSD.
More research is needed for {Net,Open}BSD support.

Indentation is left as-is for the linux code as I intend to simplify it in a
future MR, this way the diff is minimal.
2020-05-18 16:00:23 +02:00
086e683c99 [__file] add "default values" in manual for group, mode and owner
Because at least the --mode default value may not be expected, the
manual lists the "default values". As they are not explicitly set in the
`__file` type, it is a bit more difficult, but should resolve to
following:
  - the mode comes from the umask set in the cdist code to protect file
    creation and uses the strongest umask possible.
  - the owner and group comes from the ssh user, which should always be
    the root user. (I think this can be swaped, too, but who will?)

At the owner and group parameter, it could be replaced with something
like "the ssh user and group", which would be more correct, but less
understandable.
2020-05-16 16:33:38 +02:00
dcfabf9268 [__cron] add hint for default values of time-related parameters
This should resolve some misunderstanding when leave a time-related
parameter with it's default value.
2020-05-16 14:00:02 +02:00
42f2dceeb1 [__link] fix typo in the manual 2020-05-09 18:40:44 +02:00
Nico Schottelius
d4059fd29e [__letsencrypt_cert] whitelist Ubuntu 2020-05-01 15:31:23 +02:00
Nico Schottelius
f58d662b32 [__pyvenv] Switch to python3 -m venv for ubuntu 2020-05-01 15:28:01 +02:00
ea3bd14d8b [logging] Mute warning on return_output=True when running scripts.
This fixes #806 which contains more information about the issue.

The TL;DR: this warning is not being useful and hinders debugging types because
it creates an innecessary line for each explorer.

An alternative proposal was #807 but was abandoned in favour of just dropping
the warning.
2020-04-28 14:54:51 +02:00
678df1ec8a [explorers] Improve *BSD support.
cpu_cores and memory did lacked support for other BSDs.
2020-04-27 01:29:37 +02:00
8074f02bb3 Merge branch 'evilham-pf' into 'master'
[__pf*] (~) __pf_ruleset (+)__pf_apply_anchor, deprecate __pf_apply

See merge request ungleich-public/cdist!867
2020-04-26 09:59:24 +02:00
71156258a4 Merge branch 'evilham-postfix' into 'master'
[__postfix] Automagically support more OSs by not checking too much.

See merge request ungleich-public/cdist!866
2020-04-26 09:52:08 +02:00
c13608fab5 Merge branch 'evilham-openldap_server' into 'master'
[__openldap_server] Support extra config parameter.

See merge request ungleich-public/cdist!865
2020-04-26 09:50:21 +02:00
b40b95d758 Merge branch 'evilham-motd' into 'master'
[__motd] Improve documentation and support for FreeBSD

See merge request ungleich-public/cdist!864
2020-04-26 09:47:54 +02:00
6ec3274598 Merge branch 'postgres-database-args' into 'master'
Add --template, --encoding, --lc-collate, --lc-support to __postgres_database type

See merge request ungleich-public/cdist!859
2020-04-26 09:41:30 +02:00
80d204368a Merge branch 'fix-configuration-file-location' into 'master'
Fix configuration file location

See merge request ungleich-public/cdist!863
2020-04-26 09:33:38 +02:00
2928795441 [__pf_ruleset] Fix shellcheck issue. 2020-04-25 14:54:29 +02:00
fefe90e9c9 [__pf*] (~) __pf_ruleset (+)__pf_apply_anchor, deprecate __pf_apply
__pf_apply the way it exists on cdist is not really useful and __pf_ruleset does
not take advantage of other types as it should, being instead overly complex and
not as reliable.

The new __pf_ruleset is compatible with the previous one, and __pf_apply_anchors
allows for a simple and powerful way of managing pf anchors.
The functionality previously provided by __pf_apply is still possible out of the
box in __pf_ruleset.

These patches were mostly contributed by Kamila Součková and made fit for
upstreaming by Evilham.
2020-04-25 12:23:27 +02:00
5981d0a5f1 [__postfix] Automagically support more OSs by not checking too much.
It is quite likely that the package is going to be called postfix, rather
than trying to have an exhaustive "allow list" for this package, we can
just add special cases for OSs where that is not the case (not aware of any
atm).
2020-04-25 00:22:28 +02:00
056c7c5400 [__openldap_server] Support extra config parameter.
This allows the user to, e.g. manually define ACLs, while this type does not
support that.
2020-04-25 00:12:24 +02:00
de37b0ce45 [__motd] Improve documentation and support for FreeBSD
This makes it easier to use the type just by reading the man page and also
treats FreeBSD's MOTD better.
2020-04-24 20:26:44 +02:00
Darko Poljak
38ccdfda32 Fix newly found shellcheck issues 2020-04-22 23:21:34 +02:00
742163e38c Fix configuration file location 2020-04-15 17:10:33 +02:00
c3f924d350 Add --template flag to __postgres_database type 2020-04-14 10:23:08 +02:00
Darko Poljak
704e78322e Use OrderedDict to guarantee order
Note:
> Changed in version 3.7: Dictionary order is guaranteed to be
> insertion order. This behavior was an implementation detail of
> CPython from 3.6.
2020-04-11 20:26:20 +02:00
Steven Armstrong
e19c1bb1e0 remove duplicates from conf dirs while preserving order
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-04-10 21:50:39 +02:00
Steven Armstrong
76d978d3d8 explorer/init: do not grep on non-existent init
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-04-10 10:51:17 +02:00
d53077f4e8 Add --encoding, --lc-collate, --lc-support to __postgres_database type 2020-04-06 09:30:01 +02:00
Darko Poljak
890c73f6bd Fix shellcheck issues 2020-04-02 20:18:04 +02:00
Nico Schottelius
d034fe9369 [__pyvenv] use python3 -m venv on alpine
Until python4 comes, this will work
2020-04-02 18:24:13 +02:00
Nico Schottelius
0f639a9278 Make __cron nonparallel
It fails due to removal / edit of crontab at the same time

VERBOSE: [18331]: uncloud.ungleich.ch: Running object __cron/pg_dump_cleanup
VERBOSE: [18332]: uncloud.ungleich.ch: Running object __ungleich_packages/server
VERBOSE: [18335]: uncloud.ungleich.ch: Running object __postgres_role/app
INFO: [18335]: uncloud.ungleich.ch: Processing __postgres_role/app
INFO: [18331]: uncloud.ungleich.ch: Processing __cron/pg_dump_cleanup
ERROR: [16451]: uncloud.ungleich.ch: ssh -o User=root -o ControlPath=/tmp/tmp_8eu4oep/s -o ControlMaster=auto -o ControlPersist=2h uncloud.ungleich.ch /bin/sh -c ' export __object=/var/lib/cdist/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk;  export __object_id=pg_dumpall_under_day;/bin/sh -e /var/lib/cdist/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk/code-remote': ['ssh', '-o', 'User=root', '-o', 'ControlPath=/tmp/tmp_8eu4oep/s', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=2h', 'uncloud.ungleich.ch', "/bin/sh -c ' export __object=/var/lib/cdist/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk;  export __object_id=pg_dumpall_under_day;/bin/sh -e /var/lib/cdist/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk/code-remote'"]

Error processing object '__cron/pg_dumpall_under_day'
=====================================================
name: __cron/pg_dumpall_under_day
path: /tmp/tmplaq9cwdh/6318c251013a449595327745daacf3ee/data/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk
source: /tmp/tmplaq9cwdh/6318c251013a449595327745daacf3ee/data/conf/type/__ungleich_postgresql/manifest
type: /home/nico/vcs/cdist/cdist/conf/type/__cron

code-remote:stderr
------------------
crontab: can't move 'postgres.new' to 'postgres': No such file or directory

VERBOSE: [16451]: config: Total processing time for 1 host(s): 13.98031210899353
[18:09] line:~%
2020-04-02 18:14:09 +02:00
1eb02f908b Merge branch 'fix/__package_update_index' into 'master'
[__package_update_index] Fix maxage false-positives on brand-new installations

See merge request ungleich-public/cdist!858
2020-03-29 13:53:55 +02:00
Darko Poljak
b25939cdd6 Fix shellcheck 2020-03-27 13:30:52 +01:00
11148995d1 Merge branch 'master' into 'master'
fix typo

See merge request ungleich-public/cdist!857
2020-03-27 08:50:29 +01:00
Nico Schottelius
66d9905029 [__consul_agent] make conf_dir depent on the OS 2020-03-26 21:48:17 +01:00
f00e4af5f0 fix typo 2020-03-26 21:17:32 +08:00
358e04b2af Handle specially if no time about the last index update found.
The explorer 'currage' now returns -1 if he can not find any value about
this. The gencode-remote script handle this value special to not exit if
-1 given as value.

This fixes the bug
  #803
2020-03-14 09:58:38 +01:00
fb32d6ed3f alpine uses a different getent lib which doesnt support: getent shadow 2020-03-08 16:04:02 +01:00
4b24d886eb Merge branch 'file/better-errors' into 'master'
[__file] Better errors analogous to __directory

See merge request ungleich-public/cdist!854
2020-02-26 21:50:01 +01:00
Dennis Camera
9eacba06bb [__file] Treat pre-exists as a special case in gencode-remote as it should never get there 2020-02-26 16:48:14 +01:00
Dennis Camera
46d2487f08 [__file] Give more precise error message when --state pre-exists 2020-02-26 16:40:53 +01:00
dd6b07d924 Merge branch 'directory-exists' into 'master'
[__directory] Add --state exists and --state pre-exists

See merge request ungleich-public/cdist!832
2020-02-26 16:33:37 +01:00
Dennis Camera
6b4b6534a1 [__directory] Give more precise error message when --state pre-exists 2020-02-26 16:15:23 +01:00
aa49afd61a Merge branch 'fix/explorer/disks' into 'master'
explorer/disks: Fix on NetBSD and support Linux w/o lsblk

See merge request ungleich-public/cdist!852
2020-02-26 12:53:26 +01:00
Dennis Camera
6db6dc4ac0 [explorer/disks] Add license header 2020-02-25 20:24:14 +01:00
Dennis Camera
1ef126e16f [explorer/disks] Move xargs call to the bottom 2020-02-25 20:21:35 +01:00
Dennis Camera
d3bd2669ec [explorer/disks] Support Linux without lsblk (fallback to sysfs) 2020-02-25 20:21:14 +01:00
e6f683b886 Add support for alpine (edge) package to __consul_agent 2020-02-24 09:20:49 +01:00
Dennis Camera
c6aba8d189 [explorer/disks] Fix for NetBSD
When connecting over SSH and running /bin/sh, the PATH is missing sbin locations.
sysctl is located at /sbin/sysctl on NetBSD.
2020-02-23 22:59:41 +01:00
47ec9ada10 Merge branch 'consul_agent' into 'master'
Refactor __consul_* for use with distribution packages

See merge request ungleich-public/cdist!837
2020-02-23 09:28:24 +01:00
e1b80f7222 Merge branch 'service' into 'master'
Add simple __service type

See merge request ungleich-public/cdist!847
2020-02-23 09:21:29 +01:00
2a5309b413 Merge branch 'fix/init-explorer/busybox' into 'master'
[explorer/init] Support more init systems

See merge request ungleich-public/cdist!850
2020-02-23 09:18:51 +01:00
Dennis Camera
0d6bc8e8f8 [explorer/init] Make shellcheck happy 2020-02-20 23:34:19 +01:00
Dennis Camera
0d84c91b40 [explorer/init] Fix unique() for Solaris 2020-02-20 23:34:19 +01:00
Dennis Camera
364340c8d5 [explorer/init] Refactor and testing 2020-02-20 23:34:19 +01:00
Dennis Camera
d895bb0e87 [explorer/init] Clean up 2020-02-20 23:34:19 +01:00
Dennis Camera
21c9e3db18 [explorer/init] Support more init systems 2020-02-20 23:34:11 +01:00
28d3760e29 [cdist]Update os_version for alpine 2020-02-20 09:40:55 +01:00
a3bc8f9407 __update_alternatives: remove expired comment 2020-02-19 12:59:14 +02:00
b891bb05d5 __update_alternatives: add state explorer 2020-02-19 12:58:22 +02:00
09540dc6bd Add simple __service type 2020-02-17 21:38:03 +01:00
31ad1bdaad Fix various typos and styling errors in __consul_agent, conf-dir
explorer
2020-02-17 13:43:18 +01:00
f595664924 Patch __consul_* to discover remote consul configuration dir 2020-02-17 13:42:19 +01:00
70200cd28f Refactor __consul_agent type to support distribution packages 2020-02-17 13:42:19 +01:00
Darko Poljak
0640b02f90 Fix too short title underline 2020-02-15 14:59:12 +01:00
7acbc8709b Merge branch 'postgres-role-password' into 'master'
Fix password command synthax in __postgres_role

See merge request ungleich-public/cdist!845
2020-02-15 14:36:54 +01:00
a1536933ab Fix password command synthax in __postgres_role 2020-02-15 14:16:00 +01:00
221c3820ca Merge branch 'type/__systemd_service' into 'master'
[__systemd_service] new type to manage the state of systemd services

See merge request ungleich-public/cdist!844
2020-02-15 12:22:04 +01:00
b898412faf Merge branch 'fix/__cron' into 'master'
[__cron] Fix cronjob removal if `is` and `should` don't match

See merge request ungleich-public/cdist!841
2020-02-15 12:16:58 +01:00
ef089d1c61 [__systemd_service] new type to manage the state of systemd services 2020-02-15 11:42:01 +01:00
5e6e17b3e5 Moved default parameter values from scripts to cdist parameter handling.
For more generalisation, the default parameter values are now handled by
cdist instead of trying to get a value and use a default if parameter is
not given.

It handles the default values in a more general way, instead of write
one default in (possibly) multiple places.
Problem occurred when checking the 'state' parameter, which required to
set a default value in two places.
2020-02-15 09:46:23 +01:00
a761d4842c Add check for the state parameter in manifest.
This only allow following cases:
  - present
  - absent
else, it will abort with an error message.
2020-02-15 08:21:24 +01:00
c8dbd0718e Merge branch '__package_apt_updates_index' into 'master'
__package_apt: update index cache, on installation, when it is older than one day

See merge request ungleich-public/cdist!842
2020-02-14 21:57:04 +01:00
869a38676f __package_apt: add comment about package index update 2020-02-14 19:22:06 +02:00
1be5a9d316 __package_apt: add note about updating index 2020-02-14 19:19:12 +02:00
f771840178 __mysql_privileges: fix typo 2020-02-13 17:38:34 +02:00
b7483d73eb __mysql_privileges: fix shellcheck 2020-02-13 17:38:19 +02:00
710e99f240 __mysql_privileges: fix quoting 2020-02-13 17:29:44 +02:00
b3bad9468d __package_apt: pkgcache.bin may not exist 2020-02-09 20:43:09 +02:00
08d5814e2c __package_apt: update index cache, on installation, when it is older than one day 2020-02-09 20:37:06 +02:00
0edda3b528 Merge branch 'no-stat-patch' into 'master'
__file/__directory: Patch for systems without stat(1)

See merge request ungleich-public/cdist!839
2020-02-04 07:46:28 +01:00
Dennis Camera
984e0dc8c4 [explorer/os_release] Add fallbacks to /usr/lib/os-release and /var/run/os-release 2020-02-03 19:29:04 +01:00
Dennis Camera
3b5433d63a [__directory] stat explorer patch for systems without stat(1)
Some embedded systems (like OpenWrt) do not ship a stat(1) binary.
This workaround parses the output of ls(1) and /etc/passwd, /etc/group to
gather the information needed.
2020-02-03 18:36:59 +01:00
Dennis Camera
e82dd35869 [__file] stat explorer patch for systems without stat(1)
Some embedded systems (like OpenWrt) do not ship a stat(1) binary.
This workaround parses the output of ls(1) and /etc/passwd, /etc/group to
gather the information needed.
2020-02-03 18:36:59 +01:00
Nico Schottelius
2d8afe0d16 Merge branch 'master' of code.ungleich.ch:ungleich-public/cdist 2020-02-03 17:44:55 +01:00
Nico Schottelius
f3237e5d76 [consul agent] add support for Debian 10 2020-02-03 17:44:47 +01:00
e5d86ffc93 Fix to remove cronjobs when the cronjob expression did not match. 2020-02-01 17:08:25 +01:00
Dennis Camera
4fe2dcba89 [explorer/init] Linux is a mess... 2020-01-30 18:35:50 +01:00
Dennis Camera
de1a421b68 [explorer/init] Support for Darwin and more BusyBox combinations 2020-01-30 18:04:00 +01:00
1fbd2fc2bd __acl: add --file and --directory for convenience 2020-01-19 22:51:40 +02:00
e1ac97b6a5 __acl: add --source 2020-01-19 14:02:00 +02:00
Darko Poljak
ffb3c003ca Merge branch 'ssrq/cdist-line-patches' 2020-01-17 18:07:14 +01:00
efdeab61f3 Merge branch '__apt_unattended_upgrades' into 'master'
__apt_unattended_upgrades

See merge request ungleich-public/cdist!828
2020-01-17 15:50:07 +01:00
65c5b592a5 __apt_unattended_upgrades: update manual 2020-01-17 14:48:54 +02:00
6097cd9e90 __apt_unattended_upgrades: use word expansions 2020-01-17 14:41:00 +02:00
ef2f4b9a00 __postgres_*: fix forgotten edge cases in delimited identifier escape 2020-01-17 11:24:24 +01:00
6fa0d687f7 __apt_unattended_upgrades: alternative approach 2020-01-16 01:13:27 +02:00
f5f70671cb __apt_unattended_upgrades: make parameters more speaking 2020-01-16 00:59:03 +02:00
Dennis Camera
5a9a1ba57f [__line] Produce error when file does not exist 2020-01-15 22:00:56 +01:00
b3f36dbe5b __apt_unattended_upgrades: fix typo 2020-01-15 20:51:47 +02:00
cd24a806e7 __apt_unattended_upgrades: rewrite manifest, add more parameters 2020-01-15 20:48:32 +02:00
Dennis Camera
2cf44c66d4 [__directory] Add --state exists and --state pre-exists 2020-01-15 19:00:30 +01:00
68e5502fce __apt_unattended_upgrades: move debian wiki link to manual 2020-01-15 19:27:02 +02:00
cd2d5b3f79 __apt_unattended_upgrades: all objects depend on package 2020-01-15 19:24:21 +02:00
Dennis Camera
51b1b11cc2 [__line/state] Logic fixes in explorer
This commit fixes the incorrectly reported state "wrongposition" if position is
"after" and anchor is present in the file but the line missing.
2020-01-15 17:57:45 +01:00
Dennis Camera
4cdb8aaa03 [__line/state] Make sure the index match is at the beginning
Without the == 1 all lines which contain --line as a substring match.  e.g. if
--line is "line" and the file contains the line "wrong line" this was considered
a match.
2020-01-15 17:50:43 +01:00
Dennis Camera
629d0795c8 [__line] Always add line to end if anchor is not found 2020-01-15 17:27:25 +01:00
Dennis Camera
93ec4b46aa [__line] Ensure the line is only added once 2020-01-15 17:27:25 +01:00
Darko Poljak
3258fc98e1 Fix typo 2020-01-12 12:19:49 +01:00
Darko Poljak
3f133dbc17 Info command: support tilde expansion 2020-01-11 15:26:46 +01:00
Darko Poljak
11f569959d Fix missing configuration file usage, support -g
PreOS code did not use configuration support. This fix adds support
for using cdist configuration, which takes into account cdist
configuration file, environment variables and command line options,
especially conf_dir.

It also adds support for -g, --config-file option, for specifying
custom configuration file.
2020-01-11 14:16:33 +01:00
d4bd49bbb5 __acl: rename --acl to --entry for the sake of consistency, add compatibility 2020-01-04 17:43:57 +02:00
ec8d9571f9 __apt_unattended_upgrades: add manual 2020-01-04 17:07:46 +02:00
a9d491f998 __apt_unattended_upgrades: add license header 2020-01-04 16:59:42 +02:00
94e32dcd78 __apt_unattended_upgrades: initial commit 2020-01-04 16:36:44 +02:00
1fc845480e Merge branch '__mysql' into 'master'
rewrite __mysql_database, add types __mysql_user and __mysql_privileges

See merge request ungleich-public/cdist!827
2020-01-04 13:45:15 +01:00
Darko Poljak
e4596593c0 Add cdist info command 2020-01-04 12:50:12 +01:00
4329cced82 __mysql_privileges: add manual 2020-01-03 18:55:55 +02:00
5e8dc7122d __mysql_user: add manual 2020-01-03 18:48:11 +02:00
fcc774cb7b __mysql_database: add manual 2020-01-03 18:33:23 +02:00
24862e0208 __mysql_database: carry over state 2020-01-03 18:26:11 +02:00
9a693537f4 __mysql_*: add license headers 2020-01-01 12:38:12 +02:00
c32e4040b1 __mysql_*: initial rewrite 2019-12-31 19:16:49 +02:00
beb930c0dc __postgres_*: use delimited identifiers (double quoted) in generated SQL 2019-12-31 11:34:51 +01:00
Steven Armstrong
df05abd15b bugfix: __install_chroot_umount was not using __chroot_umount/manifest
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2019-12-19 12:33:47 +01:00
Nico Schottelius
f407e8825f [consul/alpine] no init script required to be deployed anymore 2019-12-15 22:56:16 +01:00
Darko Poljak
bd4eee7925 Fix shellcheck reported issues 2019-12-12 07:37:32 +01:00
c58c4b8309 Merge branch 'evilham-openldap' into 'master'
[new-type] __openldap_server

See merge request ungleich-public/cdist!822
2019-12-10 19:33:33 +01:00
3ba230c10d [type-docs] __start_on_boot: remove unspported *BSD claim.
The type appears to support {Open,Free}BSD properly.
2019-12-10 13:12:54 +01:00
35f0d4dbfa [new-type] __openldap_server: another documentation typo. 2019-12-10 13:10:19 +01:00
79d58f0813 [new-type] __openldap_server: fix docs / dependency.
It's nicer to have slapd_flags after slapd_enable in rc.conf on freebsd.
2019-12-10 13:04:24 +01:00
22c5cd550b [new-type] __openldap_server: first public version.
This already takes care of setting up the base DN and managing it as well as
allowing for settings for the listener URLS.

The type was also made a singleton as it doesn't make much sense to setup
multiple LDAP servers on the same machine.
2019-12-10 12:49:07 +01:00
42914d26c5 [new-type] __openldap_server: sudo make nico.happy. 2019-12-09 19:59:15 +01:00
1ad605a509 [new-type] __openldap_server: Add admin-email parameter. 2019-12-09 19:49:05 +01:00
fd430eab62 [new-type] __openldap_server: Add a "schema" optional parameter. 2019-12-09 19:39:43 +01:00
bee95efa43 [new-type] __openldap_server
Originally developed at ungleich and improved for Open Sourcing by Evilham.
2019-12-09 19:13:10 +01:00
Darko Poljak
4735df1bed Add plugins-dir preos option 2019-12-09 09:48:12 +01:00
fb97574592 Merge branch 'master' into 'master'
[docs] PreOS: English nitpicking

See merge request ungleich-public/cdist!820
2019-12-06 19:46:29 +01:00
Darko Poljak
f22349ce8a Fix documentation for install types
Fixes gitlab #790.
2019-12-06 09:00:16 +01:00
58cbe53e61 Merge branch 'master' of https://code.ungleich.ch/ungleich-public/cdist 2019-12-05 23:15:11 +01:00
4f21bf534d [docs] PreOS: English nitpicking. 2019-12-05 23:14:27 +01:00
Dominique Roux
d25c72e678 [PACKAGE-UPDATE-INDEX]: Bugfix of the alpine part of the __package_update_index type 2019-12-03 10:13:46 +01:00
Darko Poljak
da274e5ef3 Redefine/reimplement CDIST_ORDER_DEPENDENCY
CDIST_ORDER_DEPENDENCY now defines type order dependency context.
cdist (emulator) maintains global state variables, as files,
order_dep_state and typeorder_dep, and per object state variable,
as file, typeorder_dep.

If order_dep_state exists then this defines that order dependency is
turned on.
If order_dep_state does not exist then order dependency is turned off.

If order dependency is on then objects created after it is turned on are
recorded into:
    * global typeorder_dep, in case of init manifest
    * object's typeorder_dep, in case of type's manifest.

If order dependency is on then requirement is injected, where object
created before current, is read from:
    * global typeorder_dep, in case of init manifest
    * object's typeorder_dep, in case of type's manifest.

Every time order dependency is turned off, typeorder_dep files are
removed, which means that type order list is cleared, context is
cleaned.

In the end cdist cleans after itself, i.e. mentioned files are removed.

When running type manifest is finished typeorder_dep file is removed.
When running config finishes global typeorder_dep and order_dep_state
files are removed.

Global type order recording is untouched.
Furthermore, for completeness, type order is now recorded for each object
too.
2019-11-27 15:04:47 +01:00
Darko Poljak
3d3b59ab87 Add pycodestyle ignores 2019-11-27 14:59:25 +01:00
Darko Poljak
c01aa576de Add/keep empty directories 2019-11-27 14:51:28 +01:00
Darko Poljak
d1c3264cce Revert "Merge branch '__clean_path_use_types' into 'master'"
This reverts commit 073523be38, reversing
changes made to 56435492a0.
2019-11-26 17:58:25 +01:00
2848a6a0f4 __clean_path: use __directory and __file types for better clarity 2019-11-25 21:52:00 +02:00
64b07af4ab give error msg to stderr 2019-11-24 17:18:34 +01:00
4ed18e3446 __hostname: silence grep exit 1, when os_version is not numeric
on Debian Sid os_version returns 'bullseye/sid'
2019-11-22 18:56:34 +02:00
01bd01573e __apt_key: use mktemp for unique temporary gpg home 2019-11-21 14:15:51 +02: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
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
Dennis Camera
a45e306123 [__hostname] Better support different versions of SuSE 2019-11-17 19:39:09 +01:00
Dennis Camera
f18bdd1fad [__hostname] Comment out support for ancient ArchLinux versions 2019-11-16 23:33:23 +01:00
Dennis Camera
a885082534 [__hostname] Little bit of clean up 2019-11-16 14:58:30 +01:00
Dennis Camera
88947d45b3 [__hostname] Add support for Solaris 2019-11-16 14:57:27 +01:00
Dennis Camera
fbe9fc4204 Merge branch 'master' into hostname 2019-10-27 20:15:03 +01:00
Dennis Camera
c939bd6bf6 [__hostname] Small fixes 2019-10-27 20:12:10 +01:00
Dennis Camera
5eb9fec550 [__hostname] Add support for Slackware 2019-10-27 20:06:12 +01:00
Dennis Camera
66c85230a0 [__hostname] Make __key_value names more meaningful 2019-10-27 20:02:59 +01:00
Dennis Camera
b9571a2bbd [__hostname] Add support for Void Linux 2019-10-27 20:02:55 +01:00
Ahmed Bilal
0ec52fd1bd alpine support added in __package_update_index 2019-10-27 18:11:08 +01:00
Dennis Camera
cbae534af5 [__hostname] Patch for modern ArchLinux without hostname(1) 2019-10-26 21:01:54 +02:00
Dennis Camera
f276813f7f [__hostname] Remove incorrectly sent messages (again)
The --onchage sent the message on the target where messaging is not supported.

Now the result is that a "changed" message is only emitted when the running
hostname changes, not when the persistent hostname changes.
2019-10-26 17:27:15 +02:00
Dennis Camera
e7279680ed [__hostname/man.rst] Add link to RFC 1178 2019-10-26 17:12:08 +02:00
Dennis Camera
6eec5f87a4 [__hostame] Simplify and revert hostnamectl to be a last resort 2019-10-26 17:11:35 +02:00
Dennis Camera
b65ceba569 [__hostame] Resolve shellcheck errors 2019-10-25 02:16:43 +02:00
Dennis Camera
d4313c7501 [__hostname] Fix checking of maximum hostname length against sysconf(3) 2019-10-25 01:41:26 +02:00
Dennis Camera
629d443f5a [__hostname] Fix "command not found" errors with old Bash 2019-10-25 01:40:48 +02:00
Dennis Camera
c3b066c147 [__hostname] Check hostname length if getconf(1) is available 2019-10-24 19:44:51 +02:00
Dmitry Bogatov
32c15f2ecb Fix spelling error in manpage 2019-10-21 12:00:52 +02:00
Nico Schottelius
9f1ec6f89e Merge branch 'master' of code.ungleich.ch:ungleich-public/cdist 2019-10-17 16:47:28 +02:00
Nico Schottelius
689b5a2992 [letsencrypt_cert] add support for alpine 2019-10-17 16:44:26 +02:00
Ahmed Bilal
f5c725a57f Fix issues/Make prometheus+grafana+blackbox types compatible with Debian 10 2019-10-15 20:19:04 +02:00
df3092d4b4 Merge branch 'select-editor-type' into 'master'
Add __sensible_editor type

See merge request ungleich-public/cdist!800
2019-10-14 11:39:27 +02:00
Dennis Camera
e462821e46 [__sensible_editor] Fix SC2028 2019-10-14 11:31:29 +02:00
Dennis Camera
9567826dc1 [__sensible_editor] Fix incorrect require variable 2019-10-14 09:21:23 +02:00
Dennis Camera
58eb474b01 [__sensible_editor] Add exists as a possible --state value 2019-10-13 13:49:51 +02:00
Dennis Camera
365974c447 [__sensible_editor] Use int comparisons in version_ge 2019-10-13 13:42:15 +02:00
Nico Schottelius
2bc26e398c [__letsencrypt_cert] Add Arch Linux support 2019-10-13 11:15:53 +02:00
Dennis Camera
9edf5e8fe0 [__sensible_utils] Fix Ubuntu version detection 2019-10-13 10:39:50 +02:00
Dennis Camera
8b0734f719 [__sensible_editor] Improve error message when a basename of an editor not in the alternatives is provided 2019-10-13 10:14:27 +02:00
Dennis Camera
3bbb7b02d2 [__sensible_editor] Allow to omit the --editor parameter if --state is absent 2019-10-13 10:14:05 +02:00
Dennis Camera
00dd16d7c3 [__sensible_editor] List available editors when an incorrect one is provided 2019-10-13 10:13:20 +02:00
Dennis Camera
cee553a6dd [__hostname] Improve systemd hostname setting
This means we write to /etc/hostname before running hostnamectl, so that
it can overwrite the file if it wants to.
2019-10-12 18:49:31 +02:00
Dennis Camera
30c7d153e8 [__hostname] Only write to distro specific file when hostnamectl is missing 2019-10-12 18:47:27 +02:00
Dennis Camera
f782a85470 [__sensible_editor] Reword limitations paragraph of man page 2019-10-12 13:27:42 +02:00
Dennis Camera
d11b191547 [__sensible_editor] Document supported operating systems in man page 2019-10-12 13:02:26 +02:00
Dennis Camera
e64d1710b5 [__sensible_editor] Add support for old Ubuntu versions 2019-10-12 13:01:39 +02:00
Dennis Camera
522100b9fb [__sensible_editor] Refactor 2019-10-12 11:07:39 +02:00
Dennis Camera
b6898b097f [__sensible_editor] Add support for RedHat derivatives
They have added sensible-utils lately.
select-editor(1) does not work because their alternatives system is broken,
but sensible-editor(1) works just fine, so we can support it.
2019-10-08 23:05:23 +02:00
0bdc62482a add new type __xymon_client 2019-10-08 19:03:38 +02:00
e9289abfab add new type __xymon_config to configure xymon-servers
This allows configuration of a xymon-server.
The server can be installed with `__xymon_server` or manually. In the
latter case the `ext/`-dir symlink has to be added.
2019-10-08 18:55:37 +02:00
48ed7f1754 correct condition -- should check on remote side 2019-10-08 18:38:33 +02:00
f35a1b9cdf add new type __xymon_apache as a helper for __xymon_server
Details in `man.rst`
2019-10-08 18:34:08 +02:00
7d235fb013 add new type __xymon_server
This type installs a Xymon monitoring-server. See https://xymon.com/ for
a demo and further information.
2019-10-08 18:19:20 +02:00
2abc34f922 Add --shallow option
Provides the capability to make shallow clones (including submodules) to deploy
repositories with huge history.

Note that this might not work with some servers (github.com) if the commit
that is required by a submodule is too far away from any reference.
2019-10-08 13:45:20 +02:00
0c7d98e89e Use --recurse-submodules instead of --recursive
The option --recursive is not documented for git >2.11 (2016),
instead --recurse-submodules should be used.
2019-10-08 13:45:13 +02:00
Darko Poljak
6d2e81d0dc Revert "Fix missed parameter file reading"
This reverts commit e1c08c25b5.

This fix was a mistake. No reading is needed, this is explorer
execution on the remote.
2019-10-08 08:30:27 +02:00
Dennis Camera
c11e757dfa [__hostname] Add support for Gentoo 2019-10-07 12:06:24 +02:00
Darko Poljak
e1c08c25b5 Fix missed parameter file reading 2019-10-07 11:29:28 +02:00
Dennis Camera
064e992a7a [__hostname] Support openSUSE and replace printf with echo 2019-10-06 21:03:49 +02:00
Dennis Camera
da1d70e16a [__hostname] Also quote hostname in FreeBSD rc.conf 2019-10-06 18:43:27 +02:00
Dennis Camera
6e1a105c22 [__hostname] Lint 2019-10-06 18:37:40 +02:00
Dennis Camera
cbb108d61c [__hostname] Copy FQDN-logic to gencode-remote
Otherwise, the code-remote gets run on the remote every time.
2019-10-06 18:35:29 +02:00
Dennis Camera
3e7cf68de5 [__hostname] Source sysconfig file instead of processing through AWK
This way quotes and expansions will be handled correctly.
2019-10-06 18:14:35 +02:00
Dennis Camera
74568e8a0a [__hostname] Use FQDN as hostname on RedHat derivatives and BSDs 2019-10-06 18:02:58 +02:00
Dennis Camera
7bf203509b [__hostname] Use __key_value exact_delimiter for shell-like files 2019-10-06 18:02:13 +02:00
Dennis Camera
77210c349e [__hostname] Extend os switches with RedHat-derivatives (CentOS, Fedora, RedHat, Scientific) 2019-10-06 18:01:36 +02:00
Dennis Camera
d43eb5b22f [__hostname] Add support for NetBSD 2019-10-06 14:02:13 +02:00
Dennis Camera
9a6ca1a343 [__sensible_editor] Remove mixed error reporting from manifest 2019-10-06 12:07:54 +02:00
Dennis Camera
1bab641c94 [explorer/hostname] Do not shorten hostname in any case 2019-10-05 18:43:06 +02:00
Dennis Camera
56c654808d [__hostname] Unify persistent hostname explorers 2019-10-05 18:27:48 +02:00
d106632b2f Added missing exit 1 in __prometheus_server cdist type 2019-10-05 07:48:58 +02:00
Dennis Camera
f5342e9a35 [explorer/hostname] Remove code reading persistent hostname 2019-10-04 20:05:01 +02:00
Dennis Camera
9e9c3982a8 Rename __select_editor to __sensible_editor 2019-10-04 14:45:14 +02:00
a432d6a51e Support Added for Debian 10* in __letsencrypt_cert 2019-10-04 14:13:10 +05:00
Dennis Camera
644768cc02 Add __select_editor type 2019-10-03 22:03:44 +02:00
Dennis Camera
ee440ec619 [__hostname] Compress state check 2019-10-03 21:41:51 +02:00
9a172b62cb Merge branch 'unquote-os-release' into 'master'
[explorer/os] Unquote values from /etc/os-release

See merge request ungleich-public/cdist!803
2019-10-03 20:32:28 +02:00
Dennis Camera
81ba849af8 Move __hostname hostname explorer to global scope 2019-10-03 19:19:06 +02:00
Dennis Camera
fba14496e7 [explorer/os] Unquote values from os-release file 2019-10-03 18:30:52 +02:00
Dennis Camera
abc765bd99 [__hostname/explorer/hostname] Darwin: Always fall back to hostname if scutil is missing or fails 2019-10-03 18:23:17 +02:00
Dennis Camera
2804a8bae6 [__hostname] Add support for macosx 2019-10-03 18:21:35 +02:00
Dennis Camera
3c9eb7bce7 [__hostname] Support all systemd OSes and prefer hostnamectl 2019-10-03 18:21:35 +02:00
4345afc8d8 Merge branch 'fix-sshkeys-escape' into 'master'
[__ssh_authorized_keys] Fix incorrectly escaped variable

See merge request ungleich-public/cdist!799
2019-10-03 07:55:14 +02:00
Dennis Camera
55f8036377 [explorer/interfaces] Always sort output
Before, only the output of ifconfig was sorted.
2019-10-02 18:10:37 +02:00
Dennis Camera
f57ce648a3 [__ssh_authorized_keys] Fix incorrectly escaped variable 2019-10-02 15:38:38 +02:00
69e5e538ac Merge branch 'nogetent-dotssh' into 'master'
[__ssh_dot_ssh] Fall back to /etc files if getent(1) is not available

See merge request ungleich-public/cdist!796
2019-10-01 13:16:25 +02:00
b57482d387 Merge branch 'nogetent-sshkeys' into 'master'
[__ssh_authorized_keys] Fall back to /etc files if getent(1) is not available

See merge request ungleich-public/cdist!797
2019-10-01 13:15:29 +02:00
b7426b30e7 Merge branch 'nogetent-user' into 'master'
[__user] Fall back to /etc files if getent(1) is not available

See merge request ungleich-public/cdist!795
2019-10-01 13:14:28 +02:00
65f9161352 Merge branch 'nogetent-group' into 'master'
[__group] Fall back to /etc files if getent(1) is not available

See merge request ungleich-public/cdist!798
2019-10-01 13:12:46 +02:00
Dennis Camera
259aa13b6a [__ssh_authorized_keys] Better path checks 2019-10-01 11:07:29 +02:00
Dennis Camera
bad3a4a4cb [__group] Fall back to /etc files if getent(1) is not available
Some (embedded) systems (and Mac OS X) don't provide getent(1). The workaround
parses /etc/group under the assumption that the system only uses local users and
groups.
2019-10-01 10:53:27 +02:00
Dennis Camera
95ab68a272 [__ssh_authorized_keys] Fall back to /etc files if getent(1) is not available
Some (embedded) systems don't provide getent(1). The workaround parses
/etc/passwd and /etc/group under the assumption that these sysems only use local
users and groups.
2019-10-01 08:43:32 +02:00
Dennis Camera
092dd19611 [__ssh_dot_ssh] Fall back to /etc files if getent(1) is not available
Some (embedded) systems don't provide getent(1). The workaround parses
/etc/passwd and /etc/group under the assumption that these sysems only use local
users and groups.
2019-10-01 08:43:12 +02:00
Dennis Camera
2d751443a4 [__user] Fall back to /etc files if getent(1) is not available
On systems without getent(1) the script would fail because "command -v getent"
exits with 1 which terminates the script due to it being called by sh -e.
2019-10-01 08:12:57 +02:00
Darko Poljak
50156bd7cd shellcheck 2019-10-01 07:10:37 +02:00
f86768ab16 Merge branch 'fix_apt_key_dearmor' into 'master'
__apt_key: fix key dearmor when fetching from uri

See merge request ungleich-public/cdist!791
2019-10-01 07:00:33 +02:00
9d26fbdfb8 Merge branch 'git-recursive' into 'master'
__git type: Add --recursive option

See merge request ungleich-public/cdist!794
2019-10-01 06:25:31 +02:00
Dennis Camera
64c247026a [__locale_system] Support Devuan 2019-09-30 14:20:41 +02:00
Dennis Camera
5c8e31b2ef [type/__git] Improve documentation of --recursive option 2019-09-30 13:22:55 +02:00
Darko Poljak
97bcfcc23c Release preos, i.e. make it non-beta 2019-09-20 19:56:17 +02:00
Darko Poljak
b657ba8221 Fix log level when verbosity option is not specified 2019-09-20 19:51:55 +02:00
Nico Schottelius
90d9326740 [__sysctl] add alpine support 2019-09-20 21:17:13 +09:00
d147f4a86f __apt_key: fix key dearmor when fetching from uri 2019-09-20 12:00:22 +03:00
Darko Poljak
799ec72369 Implement preos 2019-09-20 07:15:37 +02:00
PCoder
88fe83ed73 Fix beowulf's spelling 2019-09-14 15:24:36 +05:30
Dennis Camera
4294ff55e1 [type/__git] Add --recursive parameter 2019-09-09 16:12:16 +02:00
451dfaffe4 __docker_swarm: Fix for Docker 19.03 2019-08-23 11:28:13 +02:00
Nico Schottelius
a86893889b [letsencrypt] devuan/ascii: only install certbot package
It seems python-certbot is gone
2019-08-15 14:24:11 +02:00
Nico Schottelius
5033f67d96 Merge branch 'master' of code.ungleich.ch:ungleich-public/cdist 2019-08-15 14:20:42 +02:00
Nico Schottelius
c0aa2214aa [letsencrypt] add support for devuan/beowulf 2019-08-15 14:19:54 +02:00
Darko Poljak
2f7dc5a65d Fix variable typo 2019-08-04 21:54:13 +02:00
Dominique Roux
031d59c82c Added Devuan support for __docker type 2019-08-04 21:23:44 +02:00
Dominique Roux
a70d2e0af5 Had to change the apt_source_distribution to stable, since the repository doesn't differ in distributions 2019-07-24 13:35:46 +02:00
Dominique Roux
6bb58f8820 Updated the __grafana_dashboard type for the new package repository
- Changed the signing key uri
- Changed the repo uri
2019-07-24 13:32:39 +02:00
a4bc051ad9 __acl: use type deprecation 2019-06-21 13:02:44 +03:00
a5df0badaf __acl: add compatibility for deprecated parameters 2019-06-21 12:55:59 +03:00
91a6ecc701 __acl: rewrite 2019-06-21 12:55:59 +03:00
Darko Poljak
3cb4e76175 Allow custom message for each deprecated parameter 2019-06-20 10:54:40 +02:00
Darko Poljak
55ba49efac Add support for deprecated type parameters 2019-06-19 18:19:32 +02:00
bd27d432b1 Merge branch '__acl_improvements_vol2' into 'master'
__acl improvements vol 2

See merge request ungleich-public/cdist!780
2019-05-25 16:06:46 +02:00
1d57305d35 Use gpg key, fallback to deprecated apt-key
Fixes #762
2019-05-25 15:58:39 +02:00
Darko Poljak
4949af894e Add type deprecation support. 2019-05-20 18:50:25 +02:00
e30d76014a __acl: update man 2019-05-19 23:44:20 +03:00
02e10b1ffd __acl: fix SC1117 2019-05-19 23:27:58 +03:00
03f8c3aaed __acl: don't exit on missing file when dry run 2019-05-19 23:22:02 +03:00
Nico Schottelius
21a16f5584 consul, changelog, consul agent => alpine 2019-05-18 23:46:09 +02:00
Darko Poljak
d604a9db7a Fix pycodestyle 2019-05-17 13:03:54 +02:00
69622b0fa5 set __cdist_dry_run env var if dry-run 2019-05-16 21:58:47 +02:00
Nico Schottelius
ce52203ba3 __user add alpine support 2019-05-14 17:10:26 +02:00
Nico Schottelius
5f462d6380 ++alpine support 2019-05-14 16:49:33 +02:00
7a25ec00ed __acl: add TODO note about dry-run 2019-05-14 13:42:56 +03:00