Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active December 28, 2015 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binford2k/7437064 to your computer and use it in GitHub Desktop.
Save binford2k/7437064 to your computer and use it in GitHub Desktop.
# 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'],
}
@binford2k
Copy link
Author

@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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment