Hi,

On 11/16/2011 05:44 PM, mathie wrote:
> Hello,
> 
> I have this setup but don't know how to implement it in puppet. There
> are 3 servers: puppetmaster, agent1, agent2
> 
> In order to setup agent1, I need to run a command on agent2 and return
> the data.
> 
> I know "file" can generate() function to run a command. However, it runs
> on the puppetmaster but I need it to run on agent2 instead. Is it
> possible with puppet? How? Thanks

is this a lot of content or just a single line?
A generic approach would be to enable stored configs and have agent2
create the file resource by whatever means required (probably a custom
fact to get the data to the puppetmaster), export it and have agent1
import the file.

Pseudocode:

node 'agent2' {
  $data = $::my_custom_fact
  @@file { "/tmp/setup_data": content => $data }
}

node 'agent2' {
  File<<| title == "/tmp/setup_data" "|>>
}

HTH,
Felix

> file { "/tmp/setup_data":
>             content => generate(
>                 "/bin/sh",
>                 "/tmp/script_on_puppetmaster.sh",
>                 $myvar,
>             )
>         }

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to