Hi,
Puppet's basic mode of operation is to *tell* systems whether they
should have both the user and the key or should remove both:
class kolchanov($ensure = present) {
user { 'kolchanov': ensure => $ensure, ... }
file { '/etc/ssh/keys/kolchanov_keys': ensure => $ensure, ... ]
}
If you really have to depend on an external process creating that user
and have to react to this, then you need to code up a fact that queries
the system. This information will be run by the agent everytime before
contacting the master. See the facter documentation for more details:
http://docs.puppetlabs.com/guides/custom_facts.html
Good luck and have fun, David
On 2014-05-11 09:19, Kirill K wrote:
Hi,
file.pp:
сlass keys {
file { '/etc/ssh/keys':
ensure => directory,
}
*#I don't understand how to get variable from the operating system?*
$kolchanov_id = "id kolchanov"
*#If such user available, need copy him public key to the folder. Else,
remove an existing public key.*
if $kolchanov_id == true {
file { '/etc/ssh/keys/kolchanov_keys':
mode => '600',
owner => 'kolchanov',
group => 'users',
source => 'puppet:///files/sshkeys/kolchanov_keys',
require => file['/etc/ssh/keys']
}
} else { exec { "rm -rf /etc/ssh/keys/kolchanov_keys":
path => ["/bin", "/usr/bin"],
}
}
}
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/536F9883.3000102%40dasz.at.
For more options, visit https://groups.google.com/d/optout.