On Wednesday, May 8, 2013 9:22:16 AM UTC-5, Klavs Klavsen wrote:
>
> Hi,
>
> I have an odd problem - I have a define, as an exported resource. when
> puppet creates them on the central gdash host - it creates them with the
> correct (client) hostname (f.ex. cat
> /var/www/gdash/graph_templates/dashboards/hosts/p-web01/dash.yaml) - but
> the content has the central gdash hostname in them instead (of f.ex.
> p-web01 etc.).
>
> I do the same with nagios config - and there it works fine (only diff I
> can see, is that I do export the file resource directly (with a tag),
> instead of doing it in a define).
>
> ##definition - run on hosts
> @@gdash::hostgraphs { "${::hostname}": }
>
> ##profile on gdash server
> Gdash::Hostgraphs <<| |>> { }
>
> ##gdash::hostgraphs
>
> define gdash::hostgraphs () {
> $tplpath = "/var/www/gdash/graph_templates/dashboards"
> $hostpath = "$tplpath/hosts/$name"
> #file { "$tplpath/hosts": ensure => directory }
> file { "$tplpath/hosts/$name": ensure => directory, require =>
> File["$tplpath/hosts"] }
> #$graphs = [ 'dash.yaml', 'cpu.graph', 'io.graph', 'iops.graph',
> 'load.graph', 'memory.graph', 'nettraf.graph', 'sockets.graph']
> file { "$hostpath/dash.yaml": content => template('gdash/dash.yaml') }
> file { "$hostpath/cpu.graph": content => template('gdash/cpu.graph') }
> file { "$hostpath/io.graph": content => template('gdash/io.graph') }
> file { "$hostpath/iops.graph": content => template('gdash/iops.graph') }
> file { "$hostpath/load.graph": content => template('gdash/load.graph') }
> file { "$hostpath/memory.graph": content =>
> template('gdash/memory.graph') }
> file { "$hostpath/nettraf.graph": content =>
> template('gdash/nettraf.graph') }
> file { "$hostpath/sockets.graph": content =>
> template('gdash/sockets.graph') }
> }
>
> The templates all look kinda like this (modules/gdash/templates/dash.yaml):
> :name: <%= hostname %>
> :description: Graphs for <%= fqdn %>
>
> Anyone have any ideas?
>
> It's puppet v3.1.1
>
>
I'm not sure I would have predicted the behavior you see, but it makes
sense. When you export a resource you are exporting the resource type and
parameters. When you later import that resource, it is evaluated in the
context of the importing host, just as you see. Evidently, if you want to
convey data from the exporter to the importer then it must be carried by
parameters of the exported resource.
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.