Puppet Augeas exmaple


Just take my yesterday’s post as a example, I want Puppet to add the ‘ldap_user_uuid = notExistingAttributeName’ to the /etc/sssd/sssd.conf [domain/XXX] section on all RHEL 7 servers. Here is how I did it:

1) First use augtool to check file to understand the structure of this file. Here you can see it defines [domain/XXX] section as target[2]

[root@rhel7 ~]# augtool
augtool> ls /files/etc/sssd/sssd.conf
target[1]/ = nss
target[2]/ = domain/XXX
target[3]/ = sssd

2) Add the following to the manifest. Ensure the server has augeas installed as a prerequisite.

if $operatingsystemrelease =~ /^7\./ {
augeas {“sssd.conf”:
context => “/files/etc/sssd/sssd.conf/target[2]/”,
changes => “set ldap_user_uuid  notExistingAttributeName”,
notify  => Service[“sssd”],
require => Package[“augeas”]
}
}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s