diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/debian.pp | 18 | ||||
-rw-r--r-- | manifests/files.pp (renamed from manifests/base.pp) | 14 | ||||
-rw-r--r-- | manifests/init.pp | 15 | ||||
-rw-r--r-- | manifests/packages.pp | 21 | ||||
-rw-r--r-- | manifests/params.pp | 20 | ||||
-rw-r--r-- | manifests/redhat.pp | 13 |
6 files changed, 52 insertions, 49 deletions
diff --git a/manifests/debian.pp b/manifests/debian.pp deleted file mode 100644 index bc2e3eb..0000000 --- a/manifests/debian.pp +++ /dev/null @@ -1,18 +0,0 @@ -class augeas::debian inherits augeas::base { - - package { - ['augeas-lenses', 'libaugeas0', 'augeas-tools']: - ensure => $augeas::base::version, - before => File['/usr/share/augeas/lenses'], - } - - $augeas_ruby = $::lsbdistcodename ? { - 'wheezy' => 'libaugeas-ruby1.9.1', - default => 'libaugeas-ruby1.8', - } - - package {$augeas_ruby: - ensure => $augeas::base::rubylib_version, - } - -} diff --git a/manifests/base.pp b/manifests/files.pp index 37ad0e2..01427ad 100644 --- a/manifests/base.pp +++ b/manifests/files.pp @@ -1,15 +1,5 @@ -class augeas::base { - $lens_dir = '/usr/share/augeas/lenses' - - $version = $augeas_version ? { - '' => 'present', - default => $augeas_version - } - - $rubylib_version = $augeas_ruby_version ? { - '' => 'present', - default => $augeas_ruby_version - } +class augeas::files { + $lens_dir = $augeas::lens_dir # ensure no file not managed by puppet ends up in there. file { $lens_dir: diff --git a/manifests/init.pp b/manifests/init.pp index e82e21c..9b8ba42 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,7 +1,10 @@ -class augeas { - case $::operatingsystem { - /RedHat|CentOS|Fedora/: { include augeas::redhat } - /Debian|Ubuntu|kFreeBSD/: { include augeas::debian } - default: { include augeas::base } - } +class augeas ( + $version = $augeas_version, + $ruby_version = $augeas_ruby_version, + $lens_dir = $augeas::params::lens_dir, +) inherits augeas::params { + + class {'::augeas::packages': } -> + class {'::augeas::files': } -> + Class['augeas'] } diff --git a/manifests/packages.pp b/manifests/packages.pp new file mode 100644 index 0000000..1192933 --- /dev/null +++ b/manifests/packages.pp @@ -0,0 +1,21 @@ +class augeas::packages { + # Augeas packages + $augeas_ensure = $augeas::version ? { + '' => 'present', + default => $augeas::version + } + + package { $augeas::params::pkgs: + ensure => $augeas_ensure, + } + + # Ruby package + $ruby_ensure = $augeas::ruby_version ? { + '' => 'present', + default => $augeas::ruby_version + } + + package { $augeas::params::ruby_pkg: + ensure => $ruby_ensure, + } +} diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..e7120af --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,20 @@ +class augeas::params { + $lens_dir = '/usr/share/augeas/lenses' + + case $::osfamily { + 'RedHat': { + $ruby_pkg = 'ruby-augeas' + $augeas_pkgs = ['augeas', 'augeas-libs'] + } + + 'Debian': { + $ruby_pkg = $::lsbdistcodename ? { + 'wheezy' => 'libaugeas-ruby1.9.1', + default => 'libaugeas-ruby1.8', + } + $augeas_pkgs = ['augeas-lenses', 'libaugeas0', 'augeas-tools'] + } + + default: { fail("Unsupported OS family: ${::osfamily}") } + } +} diff --git a/manifests/redhat.pp b/manifests/redhat.pp deleted file mode 100644 index 1e95728..0000000 --- a/manifests/redhat.pp +++ /dev/null @@ -1,13 +0,0 @@ -class augeas::redhat inherits augeas::base { - - package { - ['augeas', 'augeas-libs']: - ensure => $augeas::base::version, - before => File['/usr/share/augeas/lenses'], - } - - package { 'ruby-augeas': - ensure => $augeas::base::rubylib_version, - } - -} |