[Puppet Users] Re: Augeas editing of fstab

2015-03-24 Thread Anthony Clark
Yeah I've currently got a mounttab block that controls just / and /var, but 
I'd kind of like to have it run on *any* filesystem that is xfs and mounted 
in a VM.

This augeas works for single filesystems:

augeas { 'fstabxfsnobarrier':
  context => '/files/etc/fstab/*[file="/var"][vfstype="xfs"]',
  changes => [
'rm opt',
'ins opt after vfstype[last()]',
'set opt[last()] "defaults"',
'ins opt after opt[last()]',
'set opt[last()] "nobarrier"',
  ],
}

But if I remove the [file="/var"] then it fails.

But I do have a sort of working solution now.

On Tuesday, March 24, 2015 at 8:34:32 AM UTC-4, Ryan Anderson wrote:
>
> You really ought to try using the 'mount' resource type: 
> http://docs.puppetlabs.com/references/latest/type.html#mount
>
> The native type already knows about /etc/fstab format and is far more 
> cross-platform and simple to use than augeas.
>

-- 
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/f4568848-21b6-4ea2-a2ad-cb5b4831bb82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Firewall rules by subnet

2015-03-20 Thread Anthony Clark
If your primary interfaces are consistently named, you can create if or 
case statements based on the network_eth0 and netmask_eth0 facter facts.

https://docs.puppetlabs.com/puppet/latest/reference/lang_conditional.html


On Friday, March 20, 2015 at 11:30:20 AM UTC-4, Gary Jackson wrote:
>
> I'd like to use different puppetlab/firewall rules based on the subnet of 
> the host. I'm not concerned about multi-homed hosts, which will be handled 
> as a special case. How do I go about doing this?
>

-- 
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/9746b5b8-ead8-4db1-833b-e80b29125a72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas editing of fstab

2015-03-20 Thread Anthony Clark
Hi there,

I'm trying to add the nobarrier option to our XFS mount options in 
/etc/fstab using Augeas.  I've tried this:

augeas { 'fstabxfsnobarrier': context => '/files/etc/fstab', changes => [ 
'rm /*[vfstype="xfs"]/opt', 'ins opt after vfstype="xfs"', 'set 
/*[vfstype="xfs"]/opt[last()] "defaults"', 'ins opt after vfstype="xfs"', 
'set /*[vfstype="xfs"]/opt[last()] "nobarrier"', ], }

But that isn't working. Now in the past I've done something similar with 
ext4 and /var, which does work:

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

Can Augeas only edit one line at a time, i.e. am I not allowed to do "add 
this option to every matching line"?

Any help would be greatly appreciated!

Anthony

-- 
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/b35760e2-37d6-4d07-9c2d-b0cecd2c05bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Augeas fstab - removing all opt nodes then rebuilding

2015-02-04 Thread Anthony Clark
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=
> 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=
> 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.


[Puppet Users] Re: Augeas fstab - removing all opt nodes then rebuilding

2015-02-04 Thread Anthony Clark
Running the following gives me an error:

augeas { 'fstabvarentry':
  context => '/files/etc/fstab/*[file="/var"][vfstype="ext4"]',
  changes => [
'set opt[1] "default"',
'set opt[2] "noatime"',
'set opt[3] "data"',
'set opt[3]/value "writeback"',
'set opt[4] "barrier"',
'set opt[4]/value "0"',
'set opt[5] "nobh"',  
'set opt[6] "errors"',  
'set opt[6]/value "remount-ro"',  
  ],
  #onlyif  => 'match /files/etc/fstab/*[file="/var"][vfstype="ext4"]',
}




Debug: Augeas[fstabvarentry](provider=augeas): /augeas/files/etc/fstab/error
/message = Failed to match 
{ /spec/ = /[^\001-\004\t\n #,][^\001-\004\t\n ]*/ }{ /file/ = 
/[^\001-\004\t\n 
#]+/ }{ /vfstype/ = /[^\001-\004\t\n #,=]+/ }({ /vfstype/ = /[^\001-\004\t\n 
#,=]+/ })*({ /opt/ = /[^\001-\004\t\n #,=]+/ }({ /opt/ = /[^\001-\004\t\n 
#,=]+/ })*({ /dump/ = /[0-9]+/ }({ /passno/ = /[0-9]+/ })?)?)?({ /#comment/ 
= /[^\001-\004\t\n\r ][^\001-\004\n]*[^\001-\004\t\n\r ]|[^\001-\004\t\n\r 
]/ } | ())
  with tree
{ "spec" = "/dev/mapper/vg_01-lv_var01" } { "file" = "/var" } { 
"vfstype" = "ext4" } { "opt" = "default" } { "dump" = "1" } { "passno" = "2" 
} { "opt" = "noatime" } { "opt" = "data" } { "opt" = "barrier" } { "opt" = 
"nobh" } { "opt" = "errors" }
Debug: Augeas[fstabvarentry](provider=augeas): Closed the augeas connection
Error: /Stage[main]/Wnp::Fusion::Mysql_server55/Augeas[fstabvarentry]: Could 
not evaluate: Saving failed, see debug




On Wednesday, February 4, 2015 at 10:15:29 AM UTC-5, 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/3244a696-aeef-43bb-8bc7-7180de45131f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas fstab - removing all opt nodes then rebuilding

2015-02-04 Thread Anthony Clark
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/156ba202-76f4-4d91-8e92-dfed187da948%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] example hiera.yaml that uses example42-network?

2014-10-28 Thread Anthony Clark
It was indeed an issue with the network class not being included in the 
particular environment I was using.

I've remedied that now.

Just as an aside, the syntax below was correct.

On Friday, October 24, 2014 12:54:53 PM UTC-4, Wil Cooley wrote:
>
>
>
> On Fri, Oct 24, 2014 at 7:49 AM, Anthony Clark  > wrote:
>
>> Hi All,
>>
>> Does anyone use example42-network with Hiera?  I'm trying to find an 
>> example in Hiera that configures that module.
>>
>> https://forge.puppetlabs.com/example42/network/readme
>>
>> So far I've tried, in .yaml (Hiera works OK with hostname, 
>> environment, etc etc)
>>
>> ---
>> network::interfaces_hash:
>>   eth1:
>> ipaddress: 1.2.3.4
>> netmask: 255.255.0.0
>> gateway: 1.2.3.1
>>
>> Which I think should work, based on the Puppet example from the Forge 
>> module readme:
>>
>> class { 'network': interfaces_hash => 
>>   { 'eth0' => { enable_dhcp => true, },
>> 'eth1' => { ipaddress => '10.42.42.50', netmask => '255.255.255.0', 
>> },
>>   },
>> }
>>
>
> What's actually happening when you do this?
>
> I assume you also have "include network" in your manifests?
>
> Wil
>

-- 
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/ae8c469a-b2de-4519-b91d-9e92562bc3be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] example hiera.yaml that uses example42-network?

2014-10-24 Thread Anthony Clark
Hi All,

Does anyone use example42-network with Hiera?  I'm trying to find an 
example in Hiera that configures that module.

https://forge.puppetlabs.com/example42/network/readme

So far I've tried, in .yaml (Hiera works OK with hostname, 
environment, etc etc)

---
network::interfaces_hash:
  eth1:
ipaddress: 1.2.3.4
netmask: 255.255.0.0
gateway: 1.2.3.1

Which I think should work, based on the Puppet example from the Forge 
module readme:

class { 'network': interfaces_hash => 
  { 'eth0' => { enable_dhcp => true, },
'eth1' => { ipaddress => '10.42.42.50', netmask => '255.255.255.0', },
  },
}

So, any pointers on where I'm going wrong?

Thanks in advance,

Anthony

-- 
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/c4870356-c879-4db8-864d-bd6aca71a2e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.