Kjetil Torgrim Homme wrote:
Bryan Kearney <[EMAIL PROTECTED]> 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?


You can see the my test script at [1]

However, it basically takes in raw augeas commands:

augeas {"somename":
        changes: "set /mysqld/query_cache_limit 1048576"
}


You can create an array of strings to batch them together.



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.

Why expose the lense if augeas matches that for you?


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.

How is this done in augtool today?

-- bk

[1]
 http://git.et.redhat.com/?p=ace.git;a=blob;f=modules/augeas/test.pp


_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to