Translate Augeas into Puppet speak Augeas -


using puppet's augeas capability want modify config file:

/etc/ssh/sshd_config 

without puppet i've experimented using augeas's "augtool" , found couple of lines seem work:

augtool> set /files/etc/ssh/sshd_config/match[1]/condition/user "bill","ben"    augtool> set /files/etc/ssh/sshd_config/match/settings/passwordauthentication "no"  augtool> save 

although seems work ok, don't understand purpose [1] serves here.

i've tried without success put lines puppet:

augeas { "sshd_config":   context => "/files/etc/ssh/sshd_config",   changes => [   'set match[1]/condition/user "bill","ben"',   'set settings/passwordauthentication "no"',   ],      } 

it gives error: error: /stage[main]/samipermissions/augeas[sshd_config]: not evaluate: saving failed, see debug

running puppet in debug mode tells me same thing.

does know how meant work ?

thank m0dlx. answer has moved me past error getting think i'm still bit lost array of matches. using "augtool" can following:

set /files/etc/ssh/sshd_config/match[1]/condition/user "neil","nigel" set /files/etc/ssh/sshd_config/match[1]/settings/passwordauthentication "no"  set /files/etc/ssh/sshd_config/match[2]/condition/user "yvonne","yvette" set /files/etc/ssh/sshd_config/match[2]/settings/passwordauthentication "yes"  

in config file appears as:

match user neil,nigel   passwordauthentication no match user yvonne,yvette   passwordauthentication yes 

which perfect. translated puppet as:

  augeas { "sshd_config":     context => "/files/etc/ssh/sshd_config",     changes => [       'set match[1]/condition/user "neil","nigel"',       'set match[1]/settings/passwordauthentication "no"',       'set match[2]/condition/user "yvonne","yvette"',       'set match[2]/settings/passwordauthentication "yes"',     ],   } 

but result in config file quite different:

match user neil   passwordauthentication no match user yvonne   passwordauthentication yes 

although seems work ok, don't understand purpose [1] serves here.

the [1] accessing array element, indicates want access first match entry if there multiple.

'set settings/passwordauthentication "no"',

you've missed off leading match/ had in augtool test, might cause save failure puppet.

if still have problem, please include full debug output puppet in question.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -