User Tools

Site Tools


augeas

This is an old revision of the document!


Augeas

this is nice tool to modify / edit file using script or puppet.

Here are the few command line reference || example.

Using with Puppet

Inbuilt lenses.

augeas { "sudoers":
  lens    => "Sudoers.lns",
  incl    => "/foo/sudoers",
  changes => "...",
}

Adding new file to modify.

   augeas { "idmapd_reg":
      lens   => "Phpvars.lns",
      incl   => "/etc/idmapd.conf",
      changes => [
         "set General/Domain 'k2patel.in'",
       ],
   }

Command line

How to use it on command line. use case may vary.<BR> Please see below for some command i use many times.

Usecase 1:

set /augeas/load/Phpvars/lens "Phpvars.lns"
set /augeas/load/Phpvars/incl "/var/www/vhosts/k2patel.in/sites/default/settings.php"
 
print /augeas/load
 
Search for your newly added stuff.
 
load

Usecase 2:

augtool -At "Simplelines.lns incl /usr/share/tomcat/conf/logging.properties"
 
/files/usr/share/tomcat/conf/logging.properties/21 = "org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO"
/files/usr/share/tomcat/conf/logging.properties/19 = "org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO"
/files/usr/share/tomcat/conf/logging.properties/17 = "org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO"

You can run 'augtool' and serch for the lenses provided in `ls /augeas/load/`

augeas.1467908923.txt.gz · Last modified: 2020/08/10 02:28 (external edit)