Ask Your Question

Should I have used yumrepo here?

asked 2014-02-14 15:57:07 -0600

Red Cricket gravatar image

I have this module to install jenkins for me ...

class red::profile::jenkins {
        package { yum:
                ensure => present,

        file { "jenkins.repo" :
                        path    =>      "/etc/yum.repos.d/jenkins.repo"
                ,       owner   =>      "root"
                ,       group   =>      "root"
                ,       mode    =>      0440
                ,       require =>      [ Package["yum"], Exec['import_key']]
                ,       ensure  =>      file
                ,       backup  =>      false

        exec { "download_repo": 
                command => '/usr/bin/wget -O /etc/yum.repos.d/jenkins.repo'

        exec { "import_key": 
                        command => '/bin/rpm --import'
                ,       require =>      Exec["download_repo"]

        package { jenkins:
                        ensure  => present
                ,       require => File["jenkins.repo"]

        service { jenkins:
                        ensure  => running
                ,       require => package ["jenkins"]

... it seems to work fine, but ... (more)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-02-15 16:06:31 -0600

Stefan gravatar image

If you are looking for comments on your code there are a few observations

  1. The first package resource doesn't make a lot of sense because if yum is not present, puppet will not be able to install it on a yum system (or do you run this on a system that does not originally use yum as a package manager?)
  2. the way you format your code is valid, but it does not follow the style guide which makes it harder for others to read
  3. The exec resource to download the repo file runs every time you run puppet which ...
edit flag offensive delete link more


Excellent points Stefan. Thank you.

Red Cricket gravatar imageRed Cricket ( 2014-02-17 10:42:16 -0600 )edit

answered 2014-02-14 22:12:24 -0600

spuder gravatar image

The code you have written is fine.

While using yumrepo may be more 'proper', it won't make the code much cleaner, shorter, robust, or easier to read.

For comparison, here is a good example of yumrepo

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-02-14 15:57:07 -0600

Seen: 270 times

Last updated: Feb 15 '14