I need a facter because each node have different users. The facter
return a list of local users that not are into whitelist (unique).

----------------------------

       whitelist = Array.new
       File.readlines("/etc/puppet/whitelist").each { |line|
           whitelist << line.chomp
       }

       locals = Array.new

       Etc.passwd {|u|
          locals << u.name unless u.dir[0,5] != "/
home"
       }

       ret = locals - whitelist
       ret.join(',')

----------------------------

On 5 jul, 12:16, eduardo <erodr...@gmail.com> wrote:
>  John the whitelist is a dynamic file create/update by administrators,
> so puppetmaster don't know about whilelist's content.
>  I pretending to get advantage of fileserver funcionality (instead of
> any other remote copy tool like rsync) in order to get centralized
> copy of the file whitelist to all nodes.
>
>   Regards,
>    eduardo.
>
> On 5 jul, 11:58, eduardo <erodr...@gmail.com> wrote:
>
>
>
>
>
>
>
> >  Thanks you john for your answer. I comment you something that work
> > well for me.
>
> >  I think get a solution while reading puppet cookbook. It's based on
> > run stages.
>
> >  I have site.pp :
>
> >  import 'sync_files.pp'
>
> >  Then, sync_files.pp is :
>
> >  class sync_files {
> >   notify { "sync whitelist file": }
> >   file { "/etc/puppet/whitelist":
> >          ensure => present,
> >          owner => root,
> >          group => root,
> >          mode => 644,
> >          source => 'puppet:///files/whitelist',
> >       }
>
> > }
>
> >  And finally insert the following two sentences into class updssh
>
> >      stage { "first": before => Stage["main"] }
>
> >      class { "sync_files": stage => "first" }
>
> >  That's all. Testing results are good enough.
>
> >   Regards,
> >    eduardo.
>
> > On 5 jul, 11:43, jcbollinger <john.bollin...@stjude.org> wrote:
>
> > > On Wednesday, July 4, 2012 2:37:06 PM UTC-5, eduardo wrote:
>
> > > > To be more clear about my first intend. it had init.pp  like :
>
> > > >   file { "/etc/puppet/whitelist":
> > > >          ensure => present,
> > > >          source => 'puppet:///files/whitelist',
> > > >        }
>
> > > >   $users_local =  split($localusers, '[,]')
>
> > > > ----- facter
> > > >  require 'etc'
>
> > > >  Facter.add("localusers") do
> > > >   setcode do
>
> > > >        # Whitelist users to exclude for checking valid ssh users
>
> > > >        whitelist = Array.new
>
> > > >        File.readlines("/etc/puppet/whitelist").each { |line|
>
> > > >            whitelist << line.chomp
> > > >        }
> > > > -----
>
> > > > On 4 jul, 15:07, eduardo <erodr...@gmail.com> wrote:
> > > > > Dears all,
>
> > > > >  I was testing my localusers facter by puppetmaster fileserver but i'd
> > > > > got in error
>
> > > > >   Could not retrieve localusers: No such file or directory - /etc/
> > > > > puppet/whitelist
>
> > > > >  I was pretending the file was served by fileserver of puppetmaster
> > > > > doing in init.pp :
>
> > > > >   file { "/etc/puppet/whitelist":
> > > > >        ensure => present,
>
> > > > >  Just before to call a facter.
>
> > > > >  I don't pretty sure but seems to me a issue about workflow
>
> > > > >   Client pluginsync -> Client discover system Facts -> Master
> > > > > compilation -> Client apply catalog -> Client report.
>
> > > > >   Is there any way to get a file from puppetmaster to be read it by a
> > > > > facter ?.
>
> > > > >   If it's not, I appreciate any suggestion about it.
>
> > > Facter runs after pluginsync (if enabled) and before any resources (such 
> > > as
> > > your whitelist file) are synchronized.  It must be so because the master
> > > needs the node facts to compile a catalog, and the agent uses the catalog
> > > to synchronize resources.
>
> > > What you are attempting to do sounds dubious, however.  If the master 
> > > knows
> > > what users are supposed to be whitelisted (in order to provide the needed
> > > file) then it shouldn't need facter to tell it.
>
> > > John

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to