Hi I am trying to install a yum repo using puppet, so they can install a package. But i am struggling. I cannot find much help online at all. The only code I got working was as follows, but it works first time, but additional times it gives an error due to it being installed. Does it matter I get Resource failed messages due to it being installed, or is there a check to see if its installed, or am I using the wrong code? All other code I found online gavce errors and does not even create it. Thanks class yum> { > define packages::repo_release ($source) { > exec { $name: > command =>"/bin/rpm -ivh ${source}", > creates => "/etc/yum.repos.d/${name}.repo", > } > } > > packages::repo_release { "virtualmin": > source => > > "http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm", > } > } > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/I_sDRpwl434J. 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.
There is a built in Puppet type for yum repos. The docs for it are here: http://docs.puppetlabs.com/references/latest/type.html#yumrepo You could also use a package resource with a sourch of the rpm, something like... package {"virtualmin": ensure => present, source => "http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm", provider => rpm, } HTH On Tue, Nov 20, 2012 at 1:15 PM, Laurence Cope <amitywebsolutions@gmail.com> wrote:> Hi > > I am trying to install a yum repo using puppet, so they can install a > package. But i am struggling. I cannot find much help online at all. > > The only code I got working was as follows, but it works first time, but > additional times it gives an error due to it being installed. Does it matter > I get Resource failed messages due to it being installed, or is there a > check to see if its installed, or am I using the wrong code? All other code > I found online gavce errors and does not even create it. > > Thanks > >> class yum >> { >> define packages::repo_release ($source) { >> exec { $name: >> command =>"/bin/rpm -ivh ${source}", >> creates => "/etc/yum.repos.d/${name}.repo", >> } >> } >> >> packages::repo_release { "virtualmin": >> source => >> >> "http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm", >> } >> } >> > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/I_sDRpwl434J. > 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.-- Matthaus Owens Release Manager, Puppet Labs -- 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.
On Nov 20, 2012, at 4:15 PM, Laurence Cope wrote:> Hi > > I am trying to install a yum repo using puppet, so they can install a package. But i am struggling. I cannot find much help online at all. > > The only code I got working was as follows, but it works first time, but additional times it gives an error due to it being installed. Does it matter I get Resource failed messages due to it being installed, or is there a check to see if its installed, or am I using the wrong code? All other code I found online gavce errors and does not even create it. > > Thanks > > class yum > { > define packages::repo_release ($source) { > exec { $name: > command =>"/bin/rpm -ivh ${source}", > creates => "/etc/yum.repos.d/${name}.repo", > } > } > > packages::repo_release { "virtualmin": > source => > "http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm", > } > } >You''ll want to use the yumrepo resource, documented here: http://docs.puppetlabs.com/references/latest/type.html#yumrepo Here''s an example of a basic yumrepo block: yumrepo { "myrepo": baseurl => "http://local.server.org/myrepo/$operatingsystem/$operatingsystemrelease/$architecture", descr => "My Local Repo", enabled => 1, gpgcheck => 0, } -- Peter -- 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.
This is an aside, but you should really be using gpgcheck. I define repositories with yumrepo, but I also have a separate file resource to copy the gpgkey to a local directory and set the appropriate yumrepo parameters. On Tuesday, November 20, 2012 1:22:55 PM UTC-8, pmbuko wrote:> > On Nov 20, 2012, at 4:15 PM, Laurence Cope wrote: > > Hi > > I am trying to install a yum repo using puppet, so they can install a > package. But i am struggling. I cannot find much help online at all. > > The only code I got working was as follows, but it works first time, but > additional times it gives an error due to it being installed. Does it > matter I get Resource failed messages due to it being installed, or is > there a check to see if its installed, or am I using the wrong code? All > other code I found online gavce errors and does not even create it. > > Thanks > > class yum >> { >> define packages::repo_release ($source) { >> exec { $name: >> command =>"/bin/rpm -ivh ${source}", >> creates => "/etc/yum.repos.d/${name}.repo", >> } >> } >> >> packages::repo_release { "virtualmin": >> source => >> " >> http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm >> ", >> } >> } >> >> > You''ll want to use the yumrepo resource, documented here: > > http://docs.puppetlabs.com/references/latest/type.html#yumrepo > > Here''s an example of a basic yumrepo block: > > yumrepo { "myrepo": > baseurl => " > http://local.server.org/myrepo/$operatingsystem/$operatingsystemrelease/$architecture > ", > descr => "My Local Repo", > enabled => 1, > gpgcheck => 0, > } > > -- > Peter >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/efOqiC1Az1AJ. 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.
On 11/20/2012 10:15 PM, Laurence Cope wrote:> Hi > > I am trying to install a yum repo using puppet, so they can install a > package. But i am struggling. I cannot find much help online at all. > > The only code I got working was as follows, but it works first time, but > additional times it gives an error due to it being installed. Does it > matter I get Resource failed messages due to it being installed, or is > there a check to see if its installed, or am I using the wrong code? All > other code I found online gavce errors and does not even create it. > > Thanks > > class yum > { > define packages::repo_release ($source) { > exec { $name: > command =>"/bin/rpm -ivh ${source}", > creates => "/etc/yum.repos.d/${name}.repo", > } > } > > packages::repo_release { "virtualmin": > source => > "http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm", > } > }I have my own module for managing yum repos, and here is how it looks like for example for EPEL repo: # Class: yumreposd::epel # # This module manages EPEL repo files for $lsbdistrelease # class yumreposd::epel { file { ''/etc/yum.repos.d/epel.repo'': ensure => file, mode => ''0644'', owner => root, group => root, source => "puppet:///modules/yumreposd/${::operatingsystem}/${::operatingsystemrelease}/epel.repo", require => [ Package[''epel-release''], Class[''yumreposd::base''] ], } # install package depending on major version case $::operatingsystemrelease { default: {} /^5.*/: { package { ''epel-release'': ensure => present, provider => ''rpm'', source => ''http://mirror.bytemark.co.uk/fedora/epel/5/i386/epel-release-5-4.noarch.rpm '', } } /^6.*/: { package { ''epel-release'': ensure => present, provider => ''rpm'', source => ''http://ftp-stud.hs-esslingen.de/pub/epel/6/i386/epel-release-6-7.noarch.rpm '', } } } } Notice that I manage also files section, and distribute finished epel.repo file. And in the node manifest (or template that node inherits), I just do: # yum repos stage {''yumreposd'': before => Stage[''main''] } class {''yumreposd'': stage => ''yumreposd'' } class {''yumreposd::base'': stage => ''yumreposd'' } class {''yumreposd::epel'': stage => ''yumreposd'' } class {''yumreposd::srce'': stage => ''yumreposd'' } class {''yumreposd::puppetlabs'': stage => ''yumreposd'' } This ensures that all my repos are set up before any other class, so that I don''t have to maintain dependencies on repos. If you wish I can tar the whole module and share it. -- Jakov Sosic www.srce.unizg.hr -- 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.
thanks for all that. The examples above look like some I found online (not specific to Virtualmin) which failed with errors. but maybe there were slight differences. I am off work for couple of days now, so will try these when I get back. I really appreciate it. you can tell I am new, once I get over these few hurdles I am sure I will be fine. @stephen yes I agree, I just wanted to cut it out until I got the rest working, one less thing that may cause errors! one step at a time :) -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/YcFZo7sYVVEJ. 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.
Cool, cool. If I''m installing a repo for the first time, I usually install the rpm manually on a test machine, then grab the .repo file from /etc/yum.repos.d and the referenced gpgkey, and add everything in Puppet with a custom define (which is really a wrapper around yumrepo with the additional file resource I mentioned). Makes upgrading the repo a manual process, but gives you more control. On Tuesday, November 20, 2012 1:56:51 PM UTC-8, Laurence Cope wrote:> > thanks for all that. The examples above look like some I found online (not > specific to Virtualmin) which failed with errors. but maybe there were > slight differences. I am off work for couple of days now, so will try these > when I get back. I really appreciate it. you can tell I am new, once I get > over these few hurdles I am sure I will be fine. > > @stephen yes I agree, I just wanted to cut it out until I got the rest > working, one less thing that may cause errors! one step at a time :) > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/1DkTlI1_uV4J. 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.
Also, there is a much simpler way using your original approach. The Package type has a provider parameter that can be set to rpm. So instead of an exec, you just have a package resource that installs that rpm. You should also look into the unless parameter to exec. It runs a command to determine if the exec needs to be run or not. On Tuesday, November 20, 2012 3:02:58 PM UTC-7, Stephen Price wrote:> > Cool, cool. If I''m installing a repo for the first time, I usually install > the rpm manually on a test machine, then grab the .repo file from > /etc/yum.repos.d and the referenced gpgkey, and add everything in Puppet > with a custom define (which is really a wrapper around yumrepo with the > additional file resource I mentioned). Makes upgrading the repo a manual > process, but gives you more control. > > On Tuesday, November 20, 2012 1:56:51 PM UTC-8, Laurence Cope wrote: >> >> thanks for all that. The examples above look like some I found online >> (not specific to Virtualmin) which failed with errors. but maybe there were >> slight differences. I am off work for couple of days now, so will try these >> when I get back. I really appreciate it. you can tell I am new, once I get >> over these few hurdles I am sure I will be fine. >> >> @stephen yes I agree, I just wanted to cut it out until I got the rest >> working, one less thing that may cause errors! one step at a time :) >> >>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/oIs6COHmpCUJ. 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.
Can puppet yumrepo handle a private repo that requires http auth username and password? The virtualmin repo I am using requires a username and password to login, so the URL would be:- http://username:password@software.virtualmin.com/gpl/rhel/6.3/i386/ Full class:- class yum> { > yumrepo { "virtualmin": > baseurl => > "http://username:password@software.virtualmin.com/gpl/rhel/6.3/i386/", > descr => "virtualmin", > enabled => 1, > gpgcheck => 0, > } > }But I get this error all the time that means nothing to me:- Error: /Stage[main]/Yum/Yumrepo[virtualmin]: Could not evaluate:> /etc/yum.repos.d/puppet.repo:8: Can''t parse ''Read more: > http://www.how2centos.com/centos-6-puppet-install/#ixzz2Cgm74wkh''-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/mcyJekXPKAYJ. 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.
Does anyone know what this error means, I get this nearly all the time when trying above and other classes out, this is where I am stuck adding a repo... Error: /Stage[main]/Yum/Yumrepo[virtualmin]: Could not evaluate:> /etc/yum.repos.d/puppet.repo:8: Can''t parse ''Read more: > http://www.how2centos.com/centos-6-puppet-install/#ixzz2Cgm74wkh''-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/FZYl16jDJoEJ. 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.
Does anyone know what this error means, I get this nearly all the time when trying above and other classes out, this is where I am stuck adding a repo... Error: /Stage[main]/Yum/Yumrepo[virtualmin]: Could not evaluate:> /etc/yum.repos.d/puppet.repo:8: Can''t parse ''Read more: > http://www.how2centos.com/centos-6-puppet-install/#ixzz2Cgm74wkh''I get the feeling it may mean its not a repo? This is the URL I am using, but I have used various others which I thought were repos. http://software.virtualmin.com/gpl/rhel/6.3/i386/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/dpdGPcm2nF0J. 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.
The error say that on line 8 of file /etc/yum.repos.d/puppet.repo there is something that it cannot interpret. Usually some type of syntax error, but it could be something else. Your first step is to look at that file on the host that is getting the error and see what is there. If it is not obvious, post that section of the file and with a note of which line it is complaining about. Steven Date: Sun, 25 Nov 2012 07:39:11 -0800 From: amitywebsolutions@gmail.com To: puppet-users@googlegroups.com Subject: [Puppet Users] Re: How do you install a yum repo? Does anyone know what this error means, I get this nearly all the time when trying above and other classes out, this is where I am stuck adding a repo... Error: /Stage[main]/Yum/Yumrepo[virtualmin]: Could not evaluate: /etc/yum.repos.d/puppet.repo:8: Can''t parse ''Read more: http://www.how2centos.com/centos-6-puppet-install/#ixzz2Cgm74wkh'' I get the feeling it may mean its not a repo? This is the URL I am using, but I have used various others which I thought were repos. http://software.virtualmin.com/gpl/rhel/6.3/i386/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/dpdGPcm2nF0J. 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. -- 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.
Dont worry about my error! I found it. Eventually! I was following this tutorial: And somehow, during some copying and pasting the [puppetlabs] repo text, the line "Read more http://www.how2centos.com/centos-6-puppet-install/#ixzz2Cgm74wkh" ended up in my puppet.repo file and was throwing this error. So fixed now and seems I can installed repos. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7lqDmS2A-asJ. 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.
Dont worry about my error! I found it. Eventually! I was following this tutorial: http://www.how2centos.com/centos-6-puppet-install/ And somehow, during some copying and pasting the [puppetlabs] repo text, the line "Read more http://www.how2centos.com/centos-6-puppet-install/#ixzz2Cgm74wkh" ended up in my puppet.repo file and was throwing this error. So fixed now and seems I can installed repos. On Tuesday, 20 November 2012 21:15:13 UTC, Laurence Cope wrote:> > Hi > > I am trying to install a yum repo using puppet, so they can install a > package. But i am struggling. I cannot find much help online at all. > > The only code I got working was as follows, but it works first time, but > additional times it gives an error due to it being installed. Does it > matter I get Resource failed messages due to it being installed, or is > there a check to see if its installed, or am I using the wrong code? All > other code I found online gavce errors and does not even create it. > > Thanks > > class yum >> { >> define packages::repo_release ($source) { >> exec { $name: >> command =>"/bin/rpm -ivh ${source}", >> creates => "/etc/yum.repos.d/${name}.repo", >> } >> } >> >> packages::repo_release { "virtualmin": >> source => >> " >> http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm >> ", >> } >> } >> >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/LRBzpt0Vn8kJ. 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.
Thanks Steven. The error was the line that said "Read more..." but I thought that was a Puppet output telling me to read more about the error, I got really confused! Once I looked at puppet.repo it was immediately obvious! Thanks On Sunday, 25 November 2012 21:45:59 UTC, Steven wrote:> > > The error say that on line 8 of file /etc/yum.repos.d/puppet.repo there is > something that it cannot interpret. Usually some type of syntax error, but > it could be something else. > Your first step is to look at that file on the host that is getting the > error and see what is there. If it is not obvious, post that section of the > file and with a note of which line it is complaining about. > > Steven > > > ------------------------------ > Date: Sun, 25 Nov 2012 07:39:11 -0800 > From: amityweb...@gmail.com <javascript:> > To: puppet...@googlegroups.com <javascript:> > Subject: [Puppet Users] Re: How do you install a yum repo? > > Does anyone know what this error means, I get this nearly all the time > when trying above and other classes out, this is where I am stuck adding a > repo... > > Error: /Stage[main]/Yum/Yumrepo[virtualmin]: Could not evaluate: > /etc/yum.repos.d/puppet.repo:8: Can''t parse ''Read more: > http://www.how2centos.com/centos-6-puppet-install/#ixzz2Cgm74wkh'' > > > I get the feeling it may mean its not a repo? This is the URL I am using, > but I have used various others which I thought were repos. > > http://software.virtualmin.com/gpl/rhel/6.3/i386/ > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/dpdGPcm2nF0J. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > To unsubscribe from this group, send email to > puppet-users...@googlegroups.com <javascript:>. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/NI4o4uhUCDEJ. 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.