If-than-else

24 views
Skip to first unread message

Sandro von Matterhorn

unread,
Apr 2, 2014, 6:13:20 AM4/2/14
to puppet...@googlegroups.com
Hi,

when I use a template with such code:

<% if @LDAPpuppetVar %>
do something
<% end %>

it works in a way: If the puppetVar in LDAP exist, than do something, else ignore.

But how could I manage, that if the puppetVar in LDAP exist than do something, else do something other?

Sandro von Matterhorn

unread,
Apr 2, 2014, 6:38:08 AM4/2/14
to puppet...@googlegroups.com


Okay, I got it, it's quite simple. ;-)


 <% if @LDAPpuppetVar %>
do something
<% else %>
do something else
<% end %>

But why is there no sample for this in the puppet docu? :-(

Felix Frank

unread,
Apr 2, 2014, 7:43:38 AM4/2/14
to puppet...@googlegroups.com
Hi,

On 04/02/2014 12:38 PM, Sandro von Matterhorn wrote:
> But why is there no sample for this in the puppet docu? :-(

good point. The guide in

http://docs.puppetlabs.com/guides/templating.html#erb-template-syntax

does link to official ERB documentation, but that's less than helpful.

An example for if/then/else would likely be helpful. Note that you can
send pull requests to https://github.com/puppetlabs/puppet-docs. The
guys will be super grateful, too :-)

Cheers,
Felix
Reply all
Reply to author
Forward
0 new messages