With "create_resources" the error is:

*Invalid parameter hostName on node*


And including the entry[name] in the resource name:

*Resource title must be a String, not Hash*

 

=(

On Friday, January 17, 2014 5:10:16 AM UTC-2, Andrew wrote:
>
> another option to use create_resources('hostinclude',$netentry)
> On 16 Jan 2014 23:47, "Nick Cammorato" <[email protected] <javascript:>> 
> wrote:
>
>> Your augeas resource is always called hosts_include which is why it's 
>> doing that.  Try including the entry[name] in that resource name.
>> On Jan 16, 2014 4:15 PM, "Reinaldo Lima" <[email protected] <javascript:>> 
>> wrote:
>>
>>> Hi Everyone,
>>>
>>> I'm trying to write a class that put some entries in "/etc/hosts" file 
>>> as follow below:
>>>
>>> *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*
>>> *        }*
>>>
>>> *}*
>>>
>>>
>>> and, when puppet compiles the manifest, I get the following error: 
>>>
>>> *err: Could not retrieve catalog from remote server: Error 400 on 
>>> SERVER: Duplicate declaration: Augeas[hosts_include] is already declared in 
>>> file /puppet/environments/production/modules/checklist/manifests/hosts.pp 
>>> at line 10; cannot redeclare at 
>>> /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on 
>>> node*
>>>
>>> Someone can help me?
>>>
>>> Thanks
>>>
>>> -- 
>>> 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] <javascript:>.
>>> 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.
>>>
>>  -- 
>> 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] <javascript:>.
>> 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
>> .
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to