Skip to content

Instantly share code, notes, and snippets.

@runswithd6s
Created July 11, 2014 18:41
Show Gist options
  • Save runswithd6s/b5dda1a25c38fe40aed6 to your computer and use it in GitHub Desktop.
Save runswithd6s/b5dda1a25c38fe40aed6 to your computer and use it in GitHub Desktop.
Upgrading Tomcat Ideas
class profiles::tomcat (
$package_name = 'tomcat6',
$service_name = 'tomcat6',
$ensure = present
) {
package{'tomcat':
name => $package_name,
ensure => present,
}
file{"/var/lib/${package_name}/webapps/sample.war":
ensure => $ensure,
source => "puppet:///modules/helloworld/sample.war",
require => Package[$package_name],
}
service{$service_name:
ensure => running,
enabled => true,
require => Package[$package_name]
}
}
# Explicitly
node coors {
class {'profiles::tomcat':
package_name => 'tomcat6',
service_name => 'tomcat'
}
}
node becks {
class {'profiles::tomcat':
package_name => 'tomcat7',
service_name => 'tomcat'
}
}
# When it's time to run the next upgrade, change the value for
# package_name to the appropriate version.
# hieradata version
node coors {
include profiles::tomcat
}
node beck {
include profiles::tomcat
}
# In the hieradata file for common.yaml
---
profiles::tomcat::package_name: 'tomcat6'
#EOF
# In the hieradata file for coors.yaml
---
profiles::tomcat::package_name: 'tomcat6'
# EOF
# In the hieradata file for becks.yaml
profiles::tomcat::package_name: 'tomcat7'
#EOF
# When the time comes, update the appropriate heiradata files
# Final alternative, create a factor method that returns the desired package version
#... to be determined
# Once in place, you should be able to reference it as a fact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment