In Hiera? Use %{} in place of ${} and give it a shot :)

On Tuesday, February 14, 2012, Steven Pokrandt <[email protected]> wrote:
> ok now that I have that working...  thank you!!   I have one more
question,,
> say i have the following strings.
> $version="1.2.3"
> $url="/path/to/file-${version}"
>
> is there have puppet do the replacement as if it were
> $version="1.2.3"
> $string = "/path/to/file-${version}"
>
>
> On Tue, Feb 14, 2012 at 11:38 AM, Gary Larizza <[email protected]>
wrote:
>
> Inside a class is fine, but notice that you did it INSIDE the very
defined resource type that you're calling out to (i.e. you're trying to
declare resources of type yum::wars INSIDE the parameter declaration
section OF the yum::wars defined resource type)  :)
> Try putting them in another class (or directly in your site.pp) and you
should be good to go!
>
> On Tue, Feb 14, 2012 at 11:33 AM, Steven Pokrandt <[email protected]>
wrote:
>
> We run many tomcat instances on each machine.  and the instance is not
know until another hiera call is made.  is it not possible to use create
resource in a class?
>
>
> On Tue, Feb 14, 2012 at 11:13 AM, Gary Larizza <[email protected]>
wrote:
>
>
> On Tue, Feb 14, 2012 at 11:04 AM, Steven Pokrandt <[email protected]>
wrote:
>
> here is my code, yaml and error:
> what am i missing here?
> define tomcat::wars($environment,$hostname) {
>   $instance=$name
>   $wars = hiera_hash('wars')
>   create_resources('tomcat::war',$wars)
>
> These two lines should be in your site.pp file and NOT the defined
resource type (essentially, they are creating resource FOR the defined
resource type for every instance in Hiera).  Also, check your spelling - it
should read: create_resources('tomcat::wars',$wars)   (note the plurality
of tomcat::wars).
>
>
> }
> class tomcat::war ( $wars = {} ) {
>   notice($wars)
> }
>
> wars:
>   'card-managment':
>      app_version    : '1.44'
>      app_url        :
'puppet:///card-management/${VERSION}/card-management-${VERSION}.war'
>      app_target_dir : 'card-management'
>   'perscription-transfer':
>      app_version    : '1.18'
>      app_url        :
'puppet:///prescription-transfer-webapp/${VERSION}/prescription-transfer-webapp-${VERSION}.war'
>      app_target_dir : 'perscription-transfer'
>   'pharmacy':
>      app_version    : '1.62'
>      app_url        :
'puppet:///pharmacy-webapp/${VERSION}/pharmacy-webapp-${VERSION}.war'
>      app_target_dir : 'pharmacy-webapp'
>
>
>
> could not create resource of unknown type tomcat::war at
/etc/puppet/modules/tomcat/manifests/wars.pp:4 on node
pokrsx1puppetagent.ghc.org
>
> On Tue, Feb 14, 2012 at 8:53 AM, Gary Larizza <[email protected]> wrote:
>
> Steven,
> You can use Hashes all the way.  See -->
https://github.com/glarizza/puppet-datademo/blob/master/hieradb/puppetmaster.puppetlabs.vm.yaml
for my Hiera YAML file and declare with:
> $war_installs = hiera_hash('war_installs')
> create_resources('tomcat::war', $war_installs)
>
> Does this help?
>
>

-- 

Gary Larizza
Professional Services Engineer
Puppet Labs

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to