On Wednesday, July 25, 2012 3:39:24 PM UTC-5, Nikolaos Hatzopoulos wrote:
so we define that file would be exported from node1 like:
@@file { "etc/mynode.txt:":
content => "${mycontent}"
}
I have no idea what the specifics of your situation are, so I'm trying to point you in the right direction, not to hand you a boxed solution to the problem. You can restrict the resources that will be collected by putting a selection predicate in the "<<| |>>" spaceship operator. You should be able to select by title, or it can be very convenient to apply a tag to your resource and select by that. For example:
#
# For node1
#
# This assumes that only one node will export this file:
@@file { "/etc/mynode.txt":
ensure => file,
content => "${mycontent}"
}
#################
#
# For node2
#
File<<| title == '/etc/mynode.txt' |>>
#################
Do note that exporting and collecting resources depends on having [thin] storeconfigs configured on the master. (Because, you know, the master needs to store nodes' configurations to be able to use them to configure other nodes.)
I should also say that although Puppet can do this job, it might not be the most appropriate tool. You might want to consider alternative approaches, such as (in no particular order)
- put the file under source control, such as in a git or Subversion repository. Periodically sync any changes on node1 with the repository, and periodically pull down any changes from the repository to node2.
- schedule a periodic direct copy from node1 to node2, via scp or some similar remote copy tool
"Periodic[ally]" in the above is meant to imply use of an automated scheduler, such as cron.
John