> On 30. Mar 2024, at 09:35, Albert Shih <[email protected]> wrote:
>
> Le 29/03/2024 à 18:46:47+0100, Martin Alfke a écrit
>>
> Hi,
>
>>> If I do something like
>>>
>>> $group_hosts.each | String $host | {
>>> @@file { "file for ${host}":
>>> ensure => present,
>>> path => '/etc/something.conf',
>>> tag => "File for ${host}",
>>> etc.
>>> }
>>> }
>>>
>>> I got a error
>>>
>>> Error: Could not retrieve catalog from remote server: Error 500 on SERVER:
>>> Server Error: Evaluation Error: Error while evaluating a Resource
>>> Statement, Cannot alias File[file for host1] to ["/etc/something.conf"] at
>>> (file:
>>> /etc/puppetlabs/code/environments/x/modules/thing/manifests/thing.pp, line:
>>> 72); resource ["File", "/etc/something.conf"] already declared (file:
>>> /etc/puppetlabs/code/environments/x/modules/thing/manifests/thing.pp, line:
>>> 72) (file:
>>> /etc/puppetlabs/code/environments/x/modules/thing/manifests/thing.pp, line:
>>> 72, column: 5) on node XYZ
>>>
>>> I don't see why I cannot export the same file name (with different
>>> ressource name) to different hosts.
>>
>> The combination of resource type, title and namevar must be unique.
>> path is the namevar of the file resource type.
>
> Agree. But the title is "file for ${host}" so the combination are unique (I
> don't have two same values in $group_host, in fact the value inside this
> array come from the key of hash table).
To be more precise:
1. the combination of resource type and title must be unique
AND
2. the combination of resource type and namevar must be unique
hth,
Martin
--
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/F998D7A6-5AB1-4FE2-ADBD-98B845569DB4%40gmail.com.