Tim Coote
2011-Sep-13 13:47 UTC
[Puppet Users] Add a repo from an rpm, rather than with yumrepo
Hullo I''d like to add the various rpmfusion repos to my puppet manifests. Is it possible to use yum/rpm to do this directly from the rpmfusion site, using the downloadable rpm (from the rpmfusion web site): yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm Otherwise, I''ve got to define the repo using the yumrepo type, which just seems like a lot of fragile code (the rpm generates 3 repos). tia Tim -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Doug Warner
2011-Sep-13 15:16 UTC
Re: [Puppet Users] Add a repo from an rpm, rather than with yumrepo
On 09/13/2011 09:47 AM, Tim Coote wrote:> Hullo > I''d like to add the various rpmfusion repos to my puppet manifests. Is > it possible to use yum/rpm to do this directly from the rpmfusion > site, using the downloadable rpm (from the rpmfusion web site): > > yum localinstall --nogpgcheck > http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm > > Otherwise, I''ve got to define the repo using the yumrepo type, which > just seems like a lot of fragile code (the rpm generates 3 repos). > > tia > Tim >Tim, I use this define/exec: ## # creates a repo release file by downloading the $source # # $name: name of repository (creates ${name}.repo file) # $source: URL to *-release rpm define packages::repo_release ($source) { exec { $name: command =>"/bin/rpm -Uvh ${source}", creates => "/etc/yum.repos.d/${name}.repo", } } And then I use these instances: packages::repo_release { "rpmfusion-free": source => "http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm", } packages::repo_release { "rpmfusion-nonfree": source => "http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm", } package { [ "rpmfusion-free-release", "rpmfusion-nonfree-release", ]: ensure => latest, require => [ Packages::Repo_release["rpmfusion-free"], Packages::Repo_release["rpmfusion-nonfree"], ], } -Doug
Doug Warner
2011-Sep-13 16:04 UTC
Re: [Puppet Users] Add a repo from an rpm, rather than with yumrepo
Yep, the "creates" makes exec know that the command given will create that file and won''t run once it exists. This is similar to using onlyif/unless w/ something like "test -e /etc/yum.repo.d/blah.repo". I have the requires setup on the package resources like that so the -release RPMs are installed, then they will maintain the release file and keep it updated (ensure => latest). -Doug On 09/13/2011 11:37 AM, Tim Coote wrote:> Thanks. I''ll try that. I had a simpler model using exec, but found that it > kept being run and failing. > > How do I set up the dependencies such that the exec only triggers as needed > (is that what creates=> achieves?) > > Tim > > On 13 September 2011 16:16, Doug Warner <doug@warner.fm > <mailto:doug@warner.fm>> wrote: > > On 09/13/2011 09:47 AM, Tim Coote wrote: > > Hullo > > I''d like to add the various rpmfusion repos to my puppet manifests. Is > > it possible to use yum/rpm to do this directly from the rpmfusion > > site, using the downloadable rpm (from the rpmfusion web site): > > > > yum localinstall --nogpgcheck > > > http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm > > > > Otherwise, I''ve got to define the repo using the yumrepo type, which > > just seems like a lot of fragile code (the rpm generates 3 repos). > > > > tia > > Tim > > > > Tim, > > I use this define/exec: > > ## > # creates a repo release file by downloading the $source > # > # $name: name of repository (creates ${name}.repo file) > # $source: URL to *-release rpm > define packages::repo_release ($source) { > exec { $name: > command =>"/bin/rpm -Uvh ${source}", > creates => "/etc/yum.repos.d/${name}.repo", > } > } > > > And then I use these instances: > > packages::repo_release { "rpmfusion-free": > source => > "http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm", > } > packages::repo_release { "rpmfusion-nonfree": > source => > "http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm", > } > package { [ > "rpmfusion-free-release", > "rpmfusion-nonfree-release", > ]: > ensure => latest, > require => [ > Packages::Repo_release["rpmfusion-free"], > Packages::Repo_release["rpmfusion-nonfree"], > ], > } > > -Doug > >