----- Original Message -----
> From: "Dave Ta" <[email protected]>
> To: [email protected]
> Sent: Sunday, February 3, 2013 6:53:40 AM
> Subject: [Puppet Users] Re: Puppet and Mcollective yaml file changing when it 
> shouldn't
> 
> Try using an erb template for your facts.yaml file.  Its working well for
> me so far.
> 
> # facts.yaml.erb
> <%=
>     yaml = ["---"]
>     keys = scope.to_hash.keys.reject {|k| k.to_s =~
> /(uptime_seconds|uptime_hours|timestamp|free)/}
>     keys.sort.each {|k| yaml << "#{k}: #{scope.lookupvar(k).to_s}"}
>     yaml.join("\n   ")
> %>

might have some quoting issues here with facts that have : in them etc, this one
addresses that:

<%=
  facts = scope.to_hash.reject {|k,v| k.to_s =~ 
/^(uptime.*|rubysitedir|_timestamp|memoryfree)$/ }

  facts.keys.sort.map {|f| {f => facts[f]}.to_yaml.to_a[1..-1].join}.join("\n")
%>


>  
> # manifest
> file{"/etc/mcollective/facts.yaml":
>   owner    => root,
>   group    => root,
>   mode     => 400,
>   loglevel => debug,
>   content => template("mcollective/facts.yaml.erb");
> }
> 
> --
> 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.
> 
> 
> 

-- 
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.


Reply via email to