Use Augeas to change kernel audit param fails with multiple title blocks

111 views Asked by At

This example is supposed to change the kernel line in every title block by adding or setting the audit parameter to 1. It works fine if there is only one title block but if there is more than one it doesn't do anything. Am I missing something?

Puppet Master

augeas-libs.x86_64     1.0.0-5.el6_5.1  @updates                                
puppet.noarch          2.7.25-2.el6     @epel-6server                           
puppet-server.noarch   2.7.25-2.el6     @epel-6server                           
ruby-augeas.x86_64     0.4.1-1.el6      @epel-6server

Puppet Client

yum list installed |grep -i "augeas\|puppet"
augeas-libs.x86_64     1.0.0-10.el6     @anaconda-CentOS-201703281317.x86_64/6.9       
puppet.noarch          2.7.26-2.el6     @add-ons_6.9                            
ruby-augeas.x86_64     0.4.1-1.el6      @epel-6server_6.9

My Class

augeas {
   'grub':
      context => '/files/etc/grub.conf',
      lens    => 'grub.lns',
      incl    => '/etc/grub.conf',
      changes => [
        'set title[*]/kernel/audit 1',
      ];
}

My grub file

sudo cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg00-root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password --encrypted $1$QWxxyxxyxxyxxyx$0eCHxd/
title CentOS (2.6.32-696.23.1.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-696.23.1.el6.x86_64 ro root=/dev/mapper/vg00-root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg00/swap LANG=en_US.UTF-8 rd_LVM_LV=vg00/root rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto quite rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.32-696.23.1.el6.x86_64.img
title CentOS 6 (2.6.32-696.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-696.el6.x86_64 ro root=/dev/mapper/vg00-root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg00/swap LANG=en_US.UTF-8 rd_LVM_LV=vg00/root rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto quite rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.32-696.el6.x86_64.img
1

There are 1 answers

0
Jon On

The docs for Puppet Augeas imply that set only sets the value for a single key. There is a setm command for changing multiple nodes.

https://puppet.com/docs/puppet/5.1/types/augeas.html