Created
June 11, 2010 18:07
-
-
Save eric/434833 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationManifest < Moonshine::Manifest | |
def ntp | |
package 'ntp', :ensure => :latest | |
case Facter.lsbdistid | |
when 'Ubuntu' | |
service 'ntp', :alias => 'ntp', :ensure => :running, | |
:require => package('ntp'), :pattern => 'ntpd' | |
when 'Fedora', 'RedHat' | |
service 'ntpd', :alias => 'ntp', :ensure => :running, | |
:require => package('ntp'), :pattern => 'ntpd' | |
else | |
raise "Unsupported distribution: #{_}" | |
end | |
end | |
recipe :ntp | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationManifest < Moonshine::Manifest | |
def ntp | |
service_name = for_distro('Ubuntu' => 'ntp', 'Fedora' => 'ntpd') | |
package 'ntp', :ensure => :latest | |
service service_name, :alias => 'ntp', :ensure => :running, | |
:require => package('ntp'), :pattern => 'ntpd' | |
end | |
recipe :ntp | |
def for_distro(mapping) | |
distribution = Facter.lsbdistid | |
if value = mapping[distribution.to_s] | |
value | |
else | |
raise "Unsupported distribution: #{distribution}" | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationManifest < Moonshine::Manifest | |
def ntp | |
service_name = Facter.case(:lsbdistid, 'Ubuntu' => 'ntp', 'Fedora' => 'ntpd') | |
package 'ntp', :ensure => :latest | |
service service_name, :alias => 'ntp', :ensure => :running, | |
:require => package('ntp'), :pattern => 'ntpd' | |
end | |
recipe :ntp | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationManifest < Moonshine::Manifest | |
def ntp | |
package 'ntp', :ensure => :latest | |
service 'ntp', | |
:name => Facter.case(:lsbdistid, 'Ubuntu' => 'ntp', 'Fedora' => 'ntpd'), | |
:ensure => :running, :require => package('ntp'), :pattern => 'ntpd' | |
end | |
recipe :ntp | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment