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? >>> >>> >>> On Tue, Feb 14, 2012 at 8:40 AM, spokra <[email protected]> wrote: >>> >>>> Since there are no looping constructs in puppet other that passing an >>>> array to a defined resource. >>>> I'm passing an array of hashs to a defined resource and I'm getting a >>>> string that is the contests of the hash. is there away in puppet to >>>> cast a variable to the correct data type? Or is there a better way >>>> of accomplishing this? >>>> >>>> My code is at the following github gist >>>> >>>> https://gist.github.com/1827882 >>>> >>>> -- >>>> 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. >>>> >>>> >>> >>> >>> -- >>> >>> 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. >>> >> >> >> >> -- >> Steven Pokrandt (425) 686 WABO >> http://steven.pokrandt.me/ >> >> >> -- >> 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. >> > > > > -- > > 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. > -- Steven Pokrandt (425) 686 WABO http://steven.pokrandt.me/ -- 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.
