[augeas-devel] Re: Augeas and Puppet

Kjetil Torgrim Homme kjetilho at linpro.no
Thu Jul 31 22:17:48 UTC 2008


Bryan Kearney <bkearney at redhat.com> writes:
> I am going to work on getting this into the puppet common modules,
> but if you are using puppet we have a module [1] which exposes
> augeas to puppet. It accepts a set of changes as either a single
> string, or an array of strings. It replaces using regular
> expressions to edit files, or to put an entire file into puppet as a
> template.

can you give us an example or two?

it's with Puppet I want to use Augeas, and what I had envisioned is
something like

   editfile { "/etc/my.cnf":
      lens => 'generic-ini,
      set => '/mysqld/query_cache_limit=1048576',
      rm => '/mysqld/log-slow-queries',
  }

perhaps it needs to match augtool commands more closely to keep
everyone sane.

(I think the /system/config concept is a bit too ambitious for now,
hence "generic-ini".)

"lens" indicates the filename of the lens, ie. append ".aug" and look
in the configured search path.

> Any comments on this approach would be appreciated. The goal was to
> allow a single puppet task to execute multiple changes as a single
> unit of work. This is especially important if one change requires
> adding several lines to a file.

ordering of individual snippets can be handled using require and
before.

another example:

   editfile { "/etc/ssh/sshd_config":
      lens => 'sshd,
      match => '/sshd/AcceptEnv/*',
      rm => 'match',
  }

here "match" is magic (notice no leading slash) and stands for all
matching nodes.

-- 
just some ideas,
Kjetil T.




More information about the augeas-devel mailing list