Skip to content

Instantly share code, notes, and snippets.

@domcleal domcleal/augeas.md

forked from riton/augeas.md
Last active Aug 29, 2015
Embed
What would you like to do?

After first puppet execution

augtool> print /files/etc/services/service-name[.="kerberos"]
/files/etc/services/service-name[171] = "kerberos"
/files/etc/services/service-name[171]/port = "88"
/files/etc/services/service-name[171]/protocol = "tcp"
/files/etc/services/service-name[171]/alias[1] = "kerberos5"
/files/etc/services/service-name[171]/alias[2] = "krb5"
/files/etc/services/service-name[171]/alias[3] = "kerberos-sec"
/files/etc/services/service-name[171]/#comment = "Kerberos v5"
/files/etc/services/service-name[172] = "kerberos"
/files/etc/services/service-name[172]/port = "88"
/files/etc/services/service-name[172]/protocol = "udp"
/files/etc/services/service-name[172]/alias[1] = "kerberos5"
/files/etc/services/service-name[172]/alias[2] = "krb5"
/files/etc/services/service-name[172]/alias[3] = "kerberos-sec"
/files/etc/services/service-name[172]/#comment = "Kerberos v5"

After second puppet execution

augtool> print /files/etc/services/service-name[.="kerberos"]
/files/etc/services/service-name[171] = "kerberos"
/files/etc/services/service-name[171]/port = "88"
/files/etc/services/service-name[171]/protocol = "tcp"
/files/etc/services/service-name[171]/alias[1] = "kerberos5"
/files/etc/services/service-name[171]/alias[2] = "krb5"
/files/etc/services/service-name[171]/alias[3] = "kerberos-sec"
/files/etc/services/service-name[171]/alias[4] = "kerberos-sec"
/files/etc/services/service-name[171]/#comment = "Kerberos v5"
/files/etc/services/service-name[172] = "kerberos"
/files/etc/services/service-name[172]/port = "88"
/files/etc/services/service-name[172]/protocol = "udp"
/files/etc/services/service-name[172]/alias[1] = "kerberos5"
/files/etc/services/service-name[172]/alias[2] = "krb5"
/files/etc/services/service-name[172]/alias[3] = "kerberos-sec"
/files/etc/services/service-name[172]/alias[4] = "kerberos-sec"
/files/etc/services/service-name[172]/#comment = "Kerberos v5"
$port = 88
$comment = 'Kerberos v5'
augeas { 'kerberos_etc_services':
context => '/files/etc/services',
changes => [
'defnode kerberostcp service-name[.="kerberos"][protocol = "tcp"] kerberos',
"set \$kerberostcp/port ${port}",
'set $kerberostcp/protocol tcp',
'ins alias after $kerberostcp/protocol',
'set $kerberostcp/alias[1] kerberos5',
'set $kerberostcp/alias[2] krb5',
'set $kerberostcp/alias[3] kerberos-sec',
"set \$kerberostcp/#comment '${comment}'",
]
}
augeas { 'kerberos_etc_services_udp':
context => '/files/etc/services',
changes => [
'defnode kerberosudp service-name[.="kerberos"][protocol = "udp"] kerberos',
"set \$kerberosudp/port ${port}",
'set $kerberosudp/protocol udp',
'ins alias after $kerberosudp/protocol',
'set $kerberosudp/alias[1] kerberos5',
'set $kerberosudp/alias[2] krb5',
'set $kerberosudp/alias[3] kerberos-sec',
"set \$kerberosudp/#comment '${comment}'",
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.