conditional require

309 views
Skip to first unread message

Kenneth Lo

unread,
Aug 6, 2012, 2:31:17 PM8/6/12
to puppet...@googlegroups.com
On a vanilla resource require statement, is there a way to define a require for either 'resource A' or 'resource B' ?

Historically our system setup increment app per version (as opposed to having a parameter to define it). Ie. Say, we have a tomcat_6 and tomcat_7 classes for tomcat v.6 and v.7 respectively. So obviously if some other resources is depending on Tomcat, a particular node would have either 6 or 7. 

Note that we have not yet utilize fact for version documentation. Thanks in advance.



--KL 



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

jcbollinger

unread,
Aug 6, 2012, 4:40:01 PM8/6/12
to puppet...@googlegroups.com


On Monday, August 6, 2012 1:31:17 PM UTC-5, Kenneth Lo wrote:
On a vanilla resource require statement, is there a way to define a require for either 'resource A' or 'resource B' ?

Historically our system setup increment app per version (as opposed to having a parameter to define it). Ie. Say, we have a tomcat_6 and tomcat_7 classes for tomcat v.6 and v.7 respectively. So obviously if some other resources is depending on Tomcat, a particular node would have either 6 or 7. 


Not directly, no.  What you can do is create, apply, and set your requirement for a class of this general form:

class tomcat {
  if $i_want_tomcat_6 {
    include 'tomcat_6'
  } else {
    include 'tomcat_7'
  }
}


John

Reply all
Reply to author
Forward
0 new messages