Björn Thoor
10/02/2024, 9:30 AMsystemd::dropin_file:
unit: elasticsearch
filename: override.conf
content: "[Service]
LimitMEMLOCK=infinity"
but sadly it doesn’t even try to create the fileTheMeier
10/02/2024, 9:33 AMTheMeier
10/02/2024, 9:35 AMBjörn Thoor
10/02/2024, 9:37 AMTheMeier
10/02/2024, 9:38 AMcontent: | ....Björn Thoor
10/02/2024, 9:45 AMBjörn Thoor
10/02/2024, 9:46 AMBjörn Thoor
10/02/2024, 9:47 AMBjörn Thoor
10/02/2024, 9:49 AMError: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Expected value of type Hash, got String (file: /etc/puppetlabs/code/environments/test/modules/systemd/manifests/init.pp, line: 316, column: 12) on node
the code:
systemd::dropin_files:
unit: elasticsearch
filename: override.conf
source: puppet:///modules/modulename/systemd/override.confTheMeier
10/02/2024, 9:52 AMTheMeier
10/02/2024, 9:53 AMBjörn Thoor
10/02/2024, 9:55 AMBjörn Thoor
10/02/2024, 10:43 AM# @param unit The target unit file to create
# @param filename The filename of the drop in. The full path is determined using the path, unit and this filename.
# @param ensure the state of this dropin file
# @param path The main systemd configuration path
# @param selinux_ignore_defaults If Puppet should ignore the default SELinux labels.
# @param content The full content of the unit file (Mutually exclusive with `$source`)
# @param source The `File` resource compatible `source` Mutually exclusive with ``$content``
# @param target If set, will force the file to be a symlink to the given target (Mutually exclusive with both `$source` and `$content`
# @param owner The owner to set on the dropin file
# @param group The group to set on the dropin file
# @param mode The mode to set on the dropin file
# @param show_diff Whether to show the diff when updating dropin file
# @param notify_service Notify a service for the unit, if it exists
# @param daemon_reload Call systemd::daemon_reload
#
define systemd::dropin_file (
Systemd::Unit $unit,
Systemd::Dropin $filename = $name,
Enum['present', 'absent', 'file'] $ensure = 'present',
Stdlib::Absolutepath $path = '/etc/systemd/system',
Boolean $selinux_ignore_defaults = false,
Optional[Variant[String,Sensitive[String]]] $content = undef,
Optional[String] $source = undef,
Optional[Stdlib::Absolutepath] $target = undef,
String $owner = 'root',
String $group = 'root',
String $mode = '0444',
Boolean $show_diff = true,
Boolean $notify_service = true,
Boolean $daemon_reload = true,
)
i don’t see what’s supposed to be a hash in the hiera dataTheMeier
10/02/2024, 11:08 AMmetadata.jsonTheMeier
10/02/2024, 11:09 AMBjörn Thoor
10/02/2024, 11:09 AMTheMeier
10/02/2024, 11:09 AMBjörn Thoor
10/02/2024, 11:09 AMBjörn Thoor
10/02/2024, 11:10 AMTheMeier
10/02/2024, 11:11 AMBjörn Thoor
10/02/2024, 11:17 AMError: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Class[Systemd]:
parameter 'dropin_files' entry 'unit' expects a Hash value, got String
parameter 'dropin_files' entry 'filename' expects a Hash value, got String
parameter 'dropin_files' entry 'source' expects a Hash value, got String (file: /etc/puppetlabs/code/environments/test/modules/elloselastic/manifests/hiera_config.pp, line: 10, column: 3) on node
tried this too:
systemd::dropin_files:
unit:
elasticsearch
filename:
override.conf
source:
puppet:///modules/modulename/systemd/override.conf
but no joy there eitherTheMeier
10/02/2024, 11:20 AMsystemd::dropin_files:
some_hash_key:
unit:elasticsearch
filename: override.conf
source: puppet:///modules/modulename/systemd/override.confBjörn Thoor
10/02/2024, 11:23 AMError: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Systemd::Dropin_file[es_override]: parameter 'unit' expects a match for Systemd::Unit = Pattern[/^[a-zA-Z0-9:\-_.\\@%]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/], got 'elasticsearch' (file: /etc/puppetlabs/code/environments/test/modules/systemd/manifests/init.pp, line: 371) on nodeTheMeier
10/02/2024, 11:26 AMelasticsearch.serviceBjörn Thoor
10/02/2024, 11:26 AMBjörn Thoor
10/02/2024, 11:27 AMNotice: /Stage[main]/Systemd/Systemd::Dropin_file[es_override]/File[/etc/systemd/system/elasticsearch.service.d]/ensure: created
Notice: /Stage[main]/Systemd/Systemd::Dropin_file[es_override]/File[/etc/systemd/system/elasticsearch.service.d/override.conf]/ensure: defined content as '{sha256}7e42b2fde283c47ad0367f8bdbef4990cc2ea0dfdb1a1e78392233fc1d02afbb'
Info: /Stage[main]/Systemd/Systemd::Dropin_file[es_override]/File[/etc/systemd/system/elasticsearch.service.d/override.conf]: Scheduling refresh of Service[elasticsearch]
Info: /Stage[main]/Systemd/Systemd::Dropin_file[es_override]/File[/etc/systemd/system/elasticsearch.service.d/override.conf]: Scheduling refresh of Systemd::Daemon_reload[elasticsearch.service]
Info: Systemd::Daemon_reload[elasticsearch.service]: Scheduling refresh of Exec[systemd-elasticsearch.service-systemctl-daemon-reload]
Notice: /Stage[main]/Systemd/Systemd::Dropin_file[es_override]/Systemd::Daemon_reload[elasticsearch.service]/Exec[systemd-elasticsearch.service-systemctl-daemon-reload]: Triggered 'refresh' from 1 event
beautiful, thanks a bunch!