Hoping someone with more puppet experience than me can give me some advice with a config I'm attempting.
I'm using saz/ssh as the module for this.
My goal
- Use this module to create a default ssh config, that gets pushed to all redhat 7/8 servers.
- Allow override of individual ssh options, on an individual server basis, through hiera
to achieve #1 I've created my own 'module' which declares the ssh::server class, and defines my options. I believe this is called a resource-like class declaration. (Shortened the code for readability)
#
class profiles::sshd::config {
class { 'ssh::server':
validate_sshd_file => true,
storeconfigs_enabled => false,
options => {
'Port' => [22],
'AddressFamily' => 'any',
'ListenAddress' => '0.0.0.0',
'Protocol' => '2',
'HostKey' => ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key','/etc/ssh/ssh_host_ed25519_key'],
'RekeyLimit' => 'default none',
'SyslogFacility' => 'AUTHPRIV',
'LogLevel' => 'INFO',
}
}
}
I then include this 'module' in my base. This works well, until I want to override any of these options on an individual server basis. I can't get hiera to work.
declaring
ssh::server::options:
Port: [2222]
in the fqdn yaml file of a server for example, does nothing. If I include the ssh::server module directly, not through my own class, the hiera overrides work.
I've tried all sorts of syntax for the hiera overrides, but never get any output on a puppet run, unless I've using the class directly. For example I've tried:
ssh::server:options:
profiles::sshd::config:
profiles::sshd::config::ssh::server:
profiles::sshd::config::options:
profiles::sshd::config::ssh::server::options:
Is there a better way I can do what I want, or can anyone offer assistance on how I can declare hiera overrides in this manner?
Any help would be incredibly helpful