On Nov 12, 12:28 pm, Roberto Bouza <bouz...@gmail.com> wrote:
> Hello,
>
> Up to right now everything is working great with puppet. I just have
> one questions.
>
> Is there a way to tell a type (like file) not to fail if something
> specific happens.

At that level of generality, why would you consider it anything other
than a failure when Puppet cannot put the system into the state you
asked it to achieve?  Puppet will apply as many resources as it can
do, despite any failures, but it doesn't have a sense of optional
state components.

If you have not already done so, you may find it useful to read the
documentation on the specific resource types you are trying to employ:
http://docs.puppetlabs.com/#resource-types.

> Let's say I have a directory which it needs to be created if its not
> there and then I mount a file system "ro" on top of that.

Puppet is good at that sort of thing.

> The first time it'll work but the second time it will fail with an
> error saying the directory is "ro" and it will fail on recursion.

What does recursion have to do with it?  Anyway, it sounds like you
may have an error in your manifests.

> There has to be a way to tell puppet that when is a "ro" just check if
> the file is there don't create it (if you ar elooking for a file
> inside a "ro" direcotry)

Puppet will not modify a file (or directory) it is managing if that
file already has the characteristics you told Puppet it should have.
You don't have to do anything special to get that behavior.
Furthermore, you can specify (replace => "no") that Puppet should not
modify the content of a managed file if it already exists; that's not
relevant for directories or symlinks because they don't have content
as such.

> I don't know if its clear what I'm trying to achieve.

No, it's not clear.  I will take a stab at giving you something
useful, but in the (likely) event that I miss, do please post example
manifests that demonstrate your problem.

First, to ensure the presence of a directory named "/ro", owned by
root:root and writable only by root:

file { "/ro":
    ensure => "directory",
    owner => "root",
    group => "root",
    mode => "0755",
# The following should be the default, but since
# you mentioned a recursion problem:
    recurse => false
}

Puppet will attempt at every run to ensure that the specified
directory exists and has the specified ownership and mode.  If you
have a file system mounted on it, then that file system may present
its view of the owner and mode of the file system root, and that's
what Puppet will work with.

Next, to ensure that a file system mount is defined (e.g. in /etc/
fstab) and that the corresponding file system is, in fact, mounted:

# (This version is for an NFS file system.
# Adjust as necessary for other FS types.)
mount { "/ro":
# example:
    device => "server.my.com:/exports/ro_remote",
    fstype => "nfs",
# I infer from the name that you want a read-only mount:
    options => "ro",
    ensure => "mounted",
# Puppet should assume this automatically, but it doesn't
# hurt to be explicit, especially when debugging:
    require => File["/ro"]
}

There are more Mount properties you may want to tweak for your
particular situation.

Cheers,

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-us...@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