Last active
December 28, 2015 03:39
-
-
Save binford2k/7437064 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
# The problem is that an RPM package may have a dependency on the asterisk-11-repo RPM | |
# package itself. If you install the other package, it will also pull in the RPM package. | |
# That's a bit icky, to be sure, but it won't actually *break* anything. | |
# | |
# The repo package would be installed, which would drop in a .repo file, but only do | |
# that ONE time. The yumrepo provider would then overwrite it with the actual contents | |
# as defined in your manifest and then maintain those properties. | |
# | |
# This is exactly how it works when you install a package with sample configuration files | |
# and then manage the real configuration files with Puppet. | |
# | |
# A manifest like below will work just fine. The .repo file that exists after Puppet runs | |
# is exactly what you've defined in the manifest and all dependencies are met. | |
# | |
# The other solution, if the name of the repository doesn't match the name of the file, is | |
# to use a file resource to just manage the .repo file itself. | |
package { 'asterisk-11-repo': | |
ensure => present, | |
source => $asterisk_package_url, | |
} | |
yumrepo { 'centos-asterisk-11': | |
baseurl => 'http://packages.asterisk.org/centos/$releasever/asterisk-11/$basearch/', | |
descr => 'CentOS-$releasever - Asterisk 11', | |
enabled => '1', | |
gpgcheck => '0', | |
require => Package['asterisk-11-repo'], | |
} | |
package { 'something-that-requires-asterisk': | |
ensure => present, | |
require => Yumrepo['centos-asterisk-11'], | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Zigg, I've updated the gist to follow a variant of the standard Package -> File -> Service pattern. In this case, install a package, update the configuration (.repo file), then use it.
You can also do something like
package { 'asterisk-11-repo':
ensure => present,
source => $asterisk_package_url,
before => Yumrepo<| |>, # resource collector, basically means all yum repositories
}