Condition based on environment

35 views
Skip to first unread message

Will S. G.

unread,
Apr 11, 2012, 8:25:19 PM4/11/12
to puppet...@googlegroups.com
Hi,

I'm using one of the git projects for my Apache configuration. I'm now playing with Puppet environments, and I need to define a few parameters based on the environment. For example, I have params.pp:

  $user = $operatingsystem ? {
    /RedHat|CentOS/ => 'apache',
    /Debian|Ubuntu/ => 'www-data',
  }

I'd like to be able to define the $user based on each environment. For example, apache is for production, and nobody is for dev. Is it possible to use a if/else statement to do this? If so, any examples I can use to understand how?

Tim Sharpe

unread,
Apr 12, 2012, 1:12:58 AM4/12/12
to puppet...@googlegroups.com
$user = $::operatingsystem ? {
  /RedHat|CentOS/ => $::environment ? {
    'production' => 'apache',
    'dev' => 'nobody',
  },
  /Debian|Ubuntu/ => 'www-data',
}
--
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/-/tkZcfooPC0wJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Reply all
Reply to author
Forward
0 new messages