Geoff Crompton
2009-Feb-27 01:12 UTC
[Puppet Users] exporter resource to push out nss-db files
In http://groups.google.com/group/puppet-users/browse_thread/thread/1dc2dbac1f6cc0de?hl=en I was asking about pushing passwd.db out to clients, and James pointed me to Exported Resources. I''ve read up on Exported Resources, but I''m not getting where I want. The wiki has http://reductivelabs.com/trac/puppet/wiki/ExportedResources#file-example which shows definining some content on node-a, and it appearing on node-b. For my passwd.db I don''t want to define the content of the file within the puppet manifest. I want a script to generate the file on one server, and then make that file available elsewhere. So I did a test. On chiraz-60 I created /var/tmp/nss.db with the content ''test''. Then I defined: node ''chiraz-60.trinity.unimelb.edu.au'' inherits default { @@file { "/var/tmp/nss.db": tag => "nss-db-file", } } node ''test-db-01.trinity.unimelb.edu.au'' inherits default { File <<| tag == ''nss-db-file'' |>> } And after running puppetd --test on both a few times, the files haven''t shown up on test-db-01. So I tried something else. I thought maybe if on chiraz-60 I defined a file with source from that machine, I could get there: node ''chiraz-60.trinity.unimelb.edu.au'' inherits default { @@file { "/var/tmp/nss2.db": tag => "nss-db-file", source => "/var/tmp/nss.db", } } node ''test-db-01.trinity.unimelb.edu.au'' inherits default { File <<| tag == ''nss-db-file'' |>> } But then when running ''puppetd --test'' on test-db-01 I see: err: //Node[test-db-01.trinity.unimelb.edu.au]/File[/var/tmp/nss2.db]: Failed to retrieve current state of resource: No specified source was found from /var/tmp/nss.db Another approach would be: node ''chiraz-60.trinity.unimelb.edu.au'' inherits default { @@file { "/var/tmp/nss.db": tag => "nss-db-file", source => "puppet:///nss.db", } } And on the puppet master install a cronjob that updates that file, where ever nss.db might be on the filesystem. But I''d prefer not to do this because my manifest is in svn, and the cronjob would be creating files inside an svn working directory that were not under revision control. Also, I''d prefer the generation of nss.db to happen on the ldap master, rather than on the puppet master. -- +-Geoff Crompton +--Debian System Administrator +---Trinity College --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Peter Meier
2009-Feb-27 08:40 UTC
[Puppet Users] Re: exporter resource to push out nss-db files
Hi there are some problems to solve with the right tools. One problem is how to get information from host A into the puppet environment? the solution: facter. Write a custom fact, which represents the content of the generated file and then use @@file{''a'': content => $custom_fact } to create an exported resource with the content. and then include the exported resouce on the other host, as you already suggested and tried. there is afair no other way how puppet could query the client for the content of a file. cheers pete --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
go8ose
2009-Feb-28 03:13 UTC
[Puppet Users] Re: exporter resource to push out nss-db files
On Feb 27, 7:40 pm, Peter Meier <peter.me...@immerda.ch> wrote:> Hi > > there are some problems to solve with the right tools. One problem is > how to get information from host A into the puppet environment? the > solution: facter. Write a custom fact, which represents the content of > the generated file and then use @@file{''a'': content => $custom_fact } to > create an exported resource with the content. and then include the > exported resouce on the other host, as you already suggested and tried. > > there is afair no other way how puppet could query the client for the > content of a file. > > cheers peteSounds interesting. Has anyone had experience with facts that contain 2Mb of binary data? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---