From d5f7c33df577ad9dddec012e77aee7d7170e0c1d Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 3 Nov 2015 13:53:56 +0100 Subject: [PATCH 1/3] [feat] [feat] Support missing ubuntu releases Add quantal, raring, saucy, trusty, utopic, vivid, wily, xenial ubuntu release --- templates/sshd_config/Ubuntu_quantal.erb | 1 + templates/sshd_config/Ubuntu_raring.erb | 1 + templates/sshd_config/Ubuntu_saucy.erb | 1 + templates/sshd_config/Ubuntu_trusty.erb | 1 + templates/sshd_config/Ubuntu_utopic.erb | 1 + templates/sshd_config/Ubuntu_vivid.erb | 1 + templates/sshd_config/Ubuntu_wily.erb | 1 + templates/sshd_config/Ubuntu_xenial.erb | 1 + 8 files changed, 8 insertions(+) create mode 120000 templates/sshd_config/Ubuntu_quantal.erb create mode 120000 templates/sshd_config/Ubuntu_raring.erb create mode 120000 templates/sshd_config/Ubuntu_saucy.erb create mode 120000 templates/sshd_config/Ubuntu_trusty.erb create mode 120000 templates/sshd_config/Ubuntu_utopic.erb create mode 120000 templates/sshd_config/Ubuntu_vivid.erb create mode 120000 templates/sshd_config/Ubuntu_wily.erb create mode 120000 templates/sshd_config/Ubuntu_xenial.erb diff --git a/templates/sshd_config/Ubuntu_quantal.erb b/templates/sshd_config/Ubuntu_quantal.erb new file mode 120000 index 0000000..6502bfc --- /dev/null +++ b/templates/sshd_config/Ubuntu_quantal.erb @@ -0,0 +1 @@ +Ubuntu.erb \ No newline at end of file diff --git a/templates/sshd_config/Ubuntu_raring.erb b/templates/sshd_config/Ubuntu_raring.erb new file mode 120000 index 0000000..6502bfc --- /dev/null +++ b/templates/sshd_config/Ubuntu_raring.erb @@ -0,0 +1 @@ +Ubuntu.erb \ No newline at end of file diff --git a/templates/sshd_config/Ubuntu_saucy.erb b/templates/sshd_config/Ubuntu_saucy.erb new file mode 120000 index 0000000..6502bfc --- /dev/null +++ b/templates/sshd_config/Ubuntu_saucy.erb @@ -0,0 +1 @@ +Ubuntu.erb \ No newline at end of file diff --git a/templates/sshd_config/Ubuntu_trusty.erb b/templates/sshd_config/Ubuntu_trusty.erb new file mode 120000 index 0000000..6502bfc --- /dev/null +++ b/templates/sshd_config/Ubuntu_trusty.erb @@ -0,0 +1 @@ +Ubuntu.erb \ No newline at end of file diff --git a/templates/sshd_config/Ubuntu_utopic.erb b/templates/sshd_config/Ubuntu_utopic.erb new file mode 120000 index 0000000..6502bfc --- /dev/null +++ b/templates/sshd_config/Ubuntu_utopic.erb @@ -0,0 +1 @@ +Ubuntu.erb \ No newline at end of file diff --git a/templates/sshd_config/Ubuntu_vivid.erb b/templates/sshd_config/Ubuntu_vivid.erb new file mode 120000 index 0000000..6502bfc --- /dev/null +++ b/templates/sshd_config/Ubuntu_vivid.erb @@ -0,0 +1 @@ +Ubuntu.erb \ No newline at end of file diff --git a/templates/sshd_config/Ubuntu_wily.erb b/templates/sshd_config/Ubuntu_wily.erb new file mode 120000 index 0000000..6502bfc --- /dev/null +++ b/templates/sshd_config/Ubuntu_wily.erb @@ -0,0 +1 @@ +Ubuntu.erb \ No newline at end of file diff --git a/templates/sshd_config/Ubuntu_xenial.erb b/templates/sshd_config/Ubuntu_xenial.erb new file mode 120000 index 0000000..6502bfc --- /dev/null +++ b/templates/sshd_config/Ubuntu_xenial.erb @@ -0,0 +1 @@ +Ubuntu.erb \ No newline at end of file From fe92ce01fabe2d1b6a966d119e24c07cd164b776 Mon Sep 17 00:00:00 2001 From: varac Date: Mon, 9 Nov 2015 10:22:58 +0100 Subject: [PATCH 2/3] [feat] Optinally disable exported resources If run masterless, we cannot export resources, so we move them to an own class. Including it can be disabled by passing "use_storedconfig" to the sshd class. --- manifests/base.pp | 18 +++--------------- manifests/init.pp | 3 ++- manifests/sshkey.pp | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 manifests/sshkey.pp diff --git a/manifests/base.pp b/manifests/base.pp index 6dddedf..abd4fb8 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -25,21 +25,9 @@ class sshd::base { case $::sshrsakey { '': { info("no sshrsakey on ${::fqdn}") } default: { - @@sshkey{$::fqdn: - ensure => present, - tag => 'fqdn', - type => ssh-rsa, - key => $::sshrsakey, - } - # In case the node has uses a shared network address, - # we don't define a sshkey resource using an IP address - if $sshd::shared_ip == 'no' { - @@sshkey{$sshd::sshkey_ipaddress: - ensure => present, - tag => 'ipaddress', - type => ssh-rsa, - key => $::sshrsakey, - } + # only export sshkey when storedconfigs is enabled + if $::sshd::use_storedconfigs { + include ::ssh::sshkey } } } diff --git a/manifests/init.pp b/manifests/init.pp index 2dfc71c..b415741 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -52,7 +52,8 @@ class sshd( $hostkey_type = versioncmp($::ssh_version, '6.5') ? { /(^1|0)/ => [ 'rsa', 'ed25519' ], /-1/ => [ 'rsa', 'dsa' ] - } + }, + $use_storedconfigs = true ) { validate_bool($manage_shorewall) diff --git a/manifests/sshkey.pp b/manifests/sshkey.pp new file mode 100644 index 0000000..df37a66 --- /dev/null +++ b/manifests/sshkey.pp @@ -0,0 +1,21 @@ +# deploys the +class sshd::sshkey { + + @@sshkey{$::fqdn: + ensure => present, + tag => 'fqdn', + type => 'ssh-rsa', + key => $::sshrsakey, + } + + # In case the node has uses a shared network address, + # we don't define a sshkey resource using an IP address + if $sshd::shared_ip == 'no' { + @@sshkey{$::sshd::sshkey_ipaddress: + ensure => present, + tag => 'ipaddress', + type => 'ssh-rsa', + key => $::sshrsakey, + } + } +} From e46479a618042a15d5d7518da74853c29b48b36e Mon Sep 17 00:00:00 2001 From: varac Date: Mon, 9 Nov 2015 17:09:30 +0100 Subject: [PATCH 3/3] [bug] Fix typo for including sshkey class --- manifests/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/base.pp b/manifests/base.pp index abd4fb8..dda9f26 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -27,7 +27,7 @@ class sshd::base { default: { # only export sshkey when storedconfigs is enabled if $::sshd::use_storedconfigs { - include ::ssh::sshkey + include ::sshd::sshkey } } }