class hosts {$netentry = {host01 => { iphost => '192.168.10.1', hostName => host01 },host02 => { iphost => '192.168.10.2', hostName => host02 },host03 => { iphost => '192.168.10.3', hostName => host03 },}define hostsinclude ($entry) {augeas { "hosts_include":incl => "/etc/hosts",lens => "Hosts.lns",changes => ["set /files/etc/hosts/01/ipaddr $entry[$name]['iphost']","set /files/etc/hosts/01/canonical$entry[$name]['hostName']",],onlyif => "match */ipaddr[ . = $entry[$name]['iphost'] ] size == 0"}}hostsinclude { ['host01','host02','host03']:entry => $netentry}}
Your augeas resource is always called hosts_include which is why it's doing that. Try including the entry[name] in that resource name.
--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
another option to use create_resources('hostinclude',$netentry)
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_GvAAXM%2BC8t3FC9xA%40mail.gmail.com.
Invalid parameter hostName on node
Resource title must be a String, not Hash
ah, right you are supplying entire hash in your defined resource. Missed it.
If your defined resource would accept: name, iphost and hostname - then you can use create_resources to define all 3 entry.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CACzr%3DFdwj-bmkdUzMoutEBLPMa%2BZA%3Dt7v98COQfT%2Bk%2BjBrUzGg%40mail.gmail.com.