system-config/modules/user/manifests/virtual/disable.pp
Ivan Udovichenko 94a556de46 Remove hardcoded commands
Add more modern and convenient way to remove users and directories.

Change-Id: I4bc0e7ced93a0c6b3faf7f65e5036ed0cd9bee89
Counter: 2
2014-12-12 11:43:37 +00:00

31 lines
689 B
Puppet

# used to remove a user
# example:
# user::virtual::disable { 'baduser': }
define user::virtual::disable(
) {
$username = $title
#1. Remove user
user { "${username}":
ensure => absent,
}
#2. remove sshkeys file(s)
file { "rm_authorized_keys_${username}":
ensure => absent,
path => "/home/${username}/.ssh/authorized_keys",
}
file { "rm_authorized_keys2_${username}":
ensure => absent,
path => "/home/${username}/.ssh/authorized_keys2",
}
#3. rm screen dir (just in case)
file { "rm_screen_${username}":
ensure => absent,
path => "/var/run/screen/S-${username}",
recurse => true,
purge => true,
force => true,
}
}