This worked for me, thanks for the help: if defined(Package['mysql55-server']) { augeas { 'fstabvarext4entry': context => '/files/etc/fstab/*[file="/var"][vfstype="ext4"]', changes => [ 'rm opt', 'ins opt after vfstype[last()]', 'set opt[last()] "defaults"', 'ins opt after opt[last()]', 'set opt[last()] "noatime"', 'ins opt after opt[last()]', 'set opt[last()] "data"', 'set opt[last()]/value "writeback"', 'ins opt after opt[last()]', 'set opt[last()] "barrier"', 'set opt[last()]/value "0"', 'ins opt after opt[last()]', 'set opt[last()] "nobh"', 'ins opt after opt[last()]', 'set opt[last()] "errors"', 'set opt[last()]/value "remount-ro"', ], } }
On Wednesday, February 4, 2015 at 10:37:20 AM UTC-5, jamese wrote: > > with augtool you can do the following: > > augtool> ls /files/etc/fstab/3/ > spec = UUID=XXXX > file = /boot/efi > vfstype = vfat > opt[1]/ = umask > opt[2]/ = shortname > dump = 0 > passno = 0 > augtool> *rm /files/etc/fstab/3/opt[*]* > rm : /files/etc/fstab/3/opt[*] 4 > augtool> ls /files/etc/fstab/3/ > spec = UUID=XXXX > file = /boot/efi > vfstype = vfat > dump = 0 > passno = 0 > augtool> > > I believe in the augeas resource you can do "rm opt[*]" for the same > result. I'd be sure you have a backup of the file before doing this on a > real box :) > > On Wednesday, 4 February 2015 15:15:29 UTC, Anthony Clark wrote: >> >> Hello All, >> >> I have a requirement to mount /var with specific options if mysql-server >> is installed and the filesystem is ext4. So far I have this: >> >> if defined(Package['mysql55-server']) { >> notice "found mysql server" >> >> augeas { 'fstabvarentry': >> context => '/files/etc/fstab/*[file="/var"][vfstype="ext4"]', >> changes => [ >> '', # remove all opt nodes >> 'ins opt[1] "defaults"', >> 'ins opt[2] "noatime"', >> # etc etc to build >> "defaults,noatime,data=writeback,barrier=0,nobh,errors=remount-ro" >> ], >> onlyif => 'match /files/etc/fstab/*[file="/var"][vfstype="ext4"]', >> } >> } >> >> Now, my problem is how to deal with all possible opt entries for the /var >> partition. I want to start off by removing *all* opt nodes then adding the >> ones I need, but I am having trouble finding the syntax on how to remove >> all opt nodes. >> >> How can I write "rm opt*" ? >> >> Thanks! >> > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/af3ab010-e4b0-4e90-8ec5-75efc2905d36%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.