Skip to content

Commit

Permalink
Allow User to add additonal systemd options to instances
Browse files Browse the repository at this point in the history
  • Loading branch information
C24-AK committed Feb 13, 2024
1 parent 7e9d28f commit bec4f1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 5 additions & 3 deletions manifests/server/instances.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
) {
include ssh::server

$sshd_instance_config = assert_type(Hash, pick($options['sshd_config'], {}))
$sshd_instance_matchblocks = assert_type(Hash, pick($options['match_blocks'], {}))
$sshd_service_options = $options['sshd_service_options']
$sshd_instance_config = assert_type(Hash, pick($options['sshd_config'], {}))
$sshd_instance_matchblocks = assert_type(Hash, pick($options['match_blocks'], {}))
$sshd_service_options = $options['sshd_service_options']
$sshd_additional_service_options = $options['sshd_additional_service_options']

#check if server is a linux
if $facts['kernel'] == 'Linux' {
case $validate_config_file {
Expand Down
13 changes: 13 additions & 0 deletions templates/ssh_instance_service.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ After=network.target sshd-keygen.service
Wants=sshd-keygen.service

[Service]
<%- if @sshd_additional_service_options -%>
<%- @sshd_additional_service_options.each do |k,v| -%>
<%- if v.is_a?(Array) -%>
<%- v.each do |a| -%>
<%- if a != '' && a != nil -%>
<%= k %>=<%= bool2str(a) %>
<%- end -%>
<%- end -%>
<%- elsif v != '' && v != nil -%>
<%= k %>=<%= bool2str(v) %>
<%- end -%>
<%- end -%>
<%- end -%>
<% if @sshd_environments_file %>
EnvironmentFile=<%= @sshd_environments_file -%>
<% end %>
Expand Down

0 comments on commit bec4f1a

Please sign in to comment.