Remove hardcoded commands
Add more modern and convenient way to remove users and directories. Change-Id: I4bc0e7ced93a0c6b3faf7f65e5036ed0cd9bee89 Counter: 2
This commit is contained in:
parent
4fda217d25
commit
94a556de46
@ -6,9 +6,8 @@ define user::virtual::disable(
|
||||
) {
|
||||
$username = $title
|
||||
#1. Remove user
|
||||
exec { "disable_${username}":
|
||||
command => "userdel ${username}",
|
||||
onlyif => "grep ^${username}: /etc/passwd",
|
||||
user { "${username}":
|
||||
ensure => absent,
|
||||
}
|
||||
#2. remove sshkeys file(s)
|
||||
file { "rm_authorized_keys_${username}":
|
||||
@ -20,9 +19,12 @@ define user::virtual::disable(
|
||||
path => "/home/${username}/.ssh/authorized_keys2",
|
||||
}
|
||||
#3. rm screen dir (just in case)
|
||||
exec { "rm_screen_${username}":
|
||||
command => "rm -rf /var/run/screen/S-${username}",
|
||||
onlyif => "ls /var/run/screen/S-${username}",
|
||||
file { "rm_screen_${username}":
|
||||
ensure => absent,
|
||||
path => "/var/run/screen/S-${username}",
|
||||
recurse => true,
|
||||
purge => true,
|
||||
force => true,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user