Skip to content

Instantly share code, notes, and snippets.

View raphink's full-sized avatar
🐝
eBPF everything!

Raphaël Pinson raphink

🐝
eBPF everything!
View GitHub Profile
[
{
"data": {
"output": {
"ensure": "0.10.0-0ubuntu4~c2c~squeeze1",
"status": "installed",
"desired": "install",
"provider": "apt",
"name": "augeas-tools",
"error": "ok"
Puppet::Type.newtype(:sshd_config) do
ensurable
newparam(:name) do
desc "The name of the entry."
isnamevar
end
newparam(:value) do
desc "Entry value."
# Alternative Augeas-based providers for Puppet
#
# Copyright (c) 2012 Raphaël Pinson
# Licensed under the Apache License, Version 2.0
require 'augeas' if Puppet.features.augeas?
Puppet::Type.type(:sshd_config).provide(:augeas) do
desc "Uses Augeas API to update an sshd_config parameter"
irb(main):054:0> aug.match('/files/etc/ssh/sshd_config/Match[count(Condition) == "2"]/Settings/PermitRootLogin')
SystemCallError: unknown error - Matching path expression '/files/etc/ssh/sshd_config/Match[count(Condition) == "2"]/Settings/PermitRootLogin' failed
from (irb):54:in `match'
from (irb):54
from (irb):52
module ApacheParams
# Define default params
def oses
@oses = ['Debian', 'RedHat', 'Ubuntu', 'CentOS']
end
def vars
@vars = {
module ApacheParamsModule
def initialize
@oses = ['Debian', 'RedHat', 'Ubuntu', 'CentOS']
@vars = {
'Debian' => {
'pkg' => 'apache2',
'apache_root' => '/var/www',
'user' => 'www-data',
raphink@obadiah:~/Documents$ cat fakeroot/etc/inittab
co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
raphink@obadiah:~/Documents$ augtool -r fakeroot/ print /files/etc/inittab
/files/etc/inittab
/files/etc/inittab/co
/files/etc/inittab/co/runlevels = "2345"
/files/etc/inittab/co/action = "respawn"
/files/etc/inittab/co/process = "/sbin/agetty xvc0 9600 vt100-nav"
$ src/augtool -I lenses/ -r / -A -t Fstab=/etc/mtab -t Fstab=/etc/fstab
augtool> ls /files/etc/
mtab/ = (none)
fstab/ = (none)
define automaster::option ($mountpoint, $value, $file='/etc/auto.master', $ensure='present') {
case $ensure {
present: {
augeas {"Set auto.master option ${name} on mountpoint ${mountpoint}":
context => "/files${file}",
changes => "set *[. = '${mountpoint}']/opt[. = '${name}'] '$value'",
}
}
absent: {
augeas {"Remove auto.master option ${name} on mountpoint ${mountpoint}":
*** glibc detected *** /home/rpinson/dev/augeas/src/.libs/lt-augtool: munmap_chunk(): invalid pointer: 0x00007f51071fba40 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7e626)[0x7f5107102626]
/home/rpinson/dev/augeas/src/.libs/lt-augtool[0x40198b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f51070a576d]
/home/rpinson/dev/augeas/src/.libs/lt-augtool[0x402171]
======= Memory map: ========
00400000-00405000 r-xp 00000000 00:15 6300840 /home/rpinson/dev/augeas/src/.libs/lt-augtool
00604000-00605000 r--p 00004000 00:15 6300840 /home/rpinson/dev/augeas/src/.libs/lt-augtool
00605000-00606000 rw-p 00005000 00:15 6300840 /home/rpinson/dev/augeas/src/.libs/lt-augtool