2009/10/13 Teyo Tyree <t...@reductivelabs.com>

>
> Hey William,
>
> Welcome to Puppet.
>
_________________________________
[wf:]
thanks


>
> On Mon, Oct 12, 2009 at 2:01 AM, william Famy <william.f...@gmail.com>
> wrote:
> > Hi.
> >
> > II am trying puppet after cfengine and I am looking for a method to use a
> > class if a file exist.
>
> One way to express this is to write a custom fact to test whether or
> not a file is on the client system.  Shouldn't be hard to follow the
> custom fact documentation.
>
> http://reductivelabs.com/trac/puppet/wiki/AddingFacts
>
> Then you can simply wrap a conditional around the fact you create.
>
__________________________________________________
[wf:]

Ok i create a small facter to test if the file is present

in /usr/lib/ruby/vendor_ruby/facter/
i use debian lenny
i create a ztestapache.rb file from selinux one

puppetmaster:/usr/lib/ruby/vendor_ruby/facter# cat ztestapache.rb
# Fact for SElinux
# Written by immerda admin team (admin(at)immerda.ch)

Facter.add("ztestapache") do
    setcode do
        result = "false"
        if FileTest.exists?("/etc/puppet/install/apache")
                    result = "true"
        end
        result
    end
end


so i the file /etc/puppet/install/apache is present i can ask puppet to
install apache2

I have to create the puppet class on my puppetmaster.

I will tell you as soon as possible.




>
> if $yourfact {
>  include yourclass
> }
>
> [...]
>
> So you can use the pattern above, but I bet there is a better way to
> model you configuration.  What is you use case?  Ignore Puppet and
> CFengine for a moment and describe the problem.  Often times there are
> simpler more maintainable patterns of expression that will yield the
> same configuration.
>
_____________________________________
[wf:]

It is easy for me to deploy config on clients computer.
Exemple. I install 20 server on differents place and i allow peaple to add,
start programme like samba

The person want to add apache. He just have to connect the web interface and
ask for samba. the web interface create an empty file
/etc/puppet/install/samba and puppet do the job to install a working samba
from the puppet master. SO I do not have to manage my puppetmaster fqdn to
add samba and every one is happy.

>
> >
> >
> > thanks for your help.
> >
> > regards
> >
> > >
> >
>
> Cheers,
> Teyo
>
>
>
> --
> Teyo Tyree :: www.reductivelabs.com :: +1.615.275.5066
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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