简体   繁体   中英

puppet linux yum install

I'm working with RHEL 6 OS, and im trying to write a script that installs packages, that i would install by using the command 'yum install ...'

package { "install-nginx" :
    ensure      => installed,
    name        => "nginx",
    }

I have several declarations like the above and i even have some exec declarations

exec {"install-git" :
    command     => "yum install git"
     }

neither of these declarations install anything. To do an installation i'm using puppet apply (path to module)

Your exec will most likely timeout, waiting for the user to input a "y" at the command line. You should have used:

exec {"install-git" :
   command => "/bin/yum install git -y"
}

But this is the wrong way to install packages with puppet. Your first code should have worked. Are you sure you don't have nginx installed on the machine already?

If you want to update the packages, you need to use 'latest' for the version:

package { [
  'nginx',
  'git',
  ]:
  ensure   => 'latest',
  provider => 'yum',
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM