Ask Your Question
0

executing remote command

asked 2014-10-01 15:04:49 -0600

stecino gravatar image

Hello,

I am new to puppet, and I am trying to do something very simple. I want to check OS version (CentOS,Rhel, Ubuntu) and then based on that issue either yum install xxx or rmp -Uvh command.

How will my manifest file look like, and how would I be compiling this module and assign it to Group of Nodes.

Thanks in advance

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-10-02 15:59:55 -0600

lavaman gravatar image

You don't actually need to do this. If the package is in your repo, just use the package resource and it will figure out which command to run:

https://docs.puppetlabs.com/reference...

edit flag offensive delete link more
0

answered 2014-10-01 18:49:59 -0600

GLN gravatar image

This has a nice example for checking operating system using case.

https://docs.puppetlabs.com/learning/...

case $operatingsystem {
  centos: { $apache = "httpd" }
  # Note that these matches are case-insensitive.
  redhat: { $apache = "httpd" }
  debian: { $apache = "apache2" }
  ubuntu: { $apache = "apache2" }
  default: { fail("Unrecognized operating system for webserver") }
}

hope this helps. GLN

edit flag offensive delete link more

Comments

Thanks alot.

stecino gravatar imagestecino ( 2014-10-02 12:59:52 -0600 )edit

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

Stats

Asked: 2014-10-01 15:04:49 -0600

Seen: 74 times

Last updated: Oct 02 '14