User Tools

Site Tools



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 ''",

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/"
print /augeas/load
Search for your newly added stuff.

Usecase 2:

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

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

Usecase 3:

/opt/puppetlabs/puppet/bin/augtool -At "Logrotate.lns incl /etc/logrotate.d/httpd"
get /files/etc/logrotate.d/httpd/rule/delaycompress
rm /files/etc/logrotate.d/httpd/rule/delaycompress
set /files/etc/logrotate.d/httpd/rule/schedule monthly


   augeas { "apache_logrotate":
     lens    => "Logrotate.lns",
     incl    => "/etc/logrotate.d/httpd",
     changes => [
        "rm /files/etc/logrotate.d/httpd/rule/delaycompress",
        "set /files/etc/logrotate.d/httpd/rule/rotate 99999",
        "set /files/etc/logrotate.d/httpd/rule/schedule monthly",
augeas.txt · Last modified: 2020/08/10 02:35 (external edit)