Merge "Split out user module"
This commit is contained in:
commit
f1e3c662aa
@ -86,6 +86,7 @@ INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-reviewday"
|
||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-drupal"]="origin/master"
|
||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-mediawiki"]="origin/master"
|
||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-unbound"]="origin/master"
|
||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-user"]="origin/master"
|
||||
|
||||
if [[ "$PUPPET_INTEGRATION_TEST" -ne "1" ]]; then
|
||||
# If puppet integration tests are not being run, merge SOURCE and INTEGRATION modules
|
||||
|
@ -1,30 +0,0 @@
|
||||
# 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,
|
||||
}
|
||||
}
|
||||
|
@ -1,51 +0,0 @@
|
||||
# usage
|
||||
#
|
||||
# user::virtual::localuser['username']
|
||||
|
||||
define user::virtual::localuser(
|
||||
$realname,
|
||||
$uid,
|
||||
$gid,
|
||||
$groups = [ 'sudo', 'admin', ],
|
||||
$sshkeys = '',
|
||||
$key_id = '',
|
||||
$old_keys = [],
|
||||
$shell = '/bin/bash',
|
||||
$home = "/home/${title}",
|
||||
$managehome = true
|
||||
) {
|
||||
|
||||
group { $title:
|
||||
ensure => present,
|
||||
gid => $gid,
|
||||
}
|
||||
|
||||
user { $title:
|
||||
ensure => present,
|
||||
comment => $realname,
|
||||
uid => $uid,
|
||||
gid => $gid,
|
||||
groups => $groups,
|
||||
home => $home,
|
||||
managehome => $managehome,
|
||||
membership => 'minimum',
|
||||
shell => $shell,
|
||||
require => Group[$title],
|
||||
}
|
||||
|
||||
ssh_authorized_key { $key_id:
|
||||
ensure => present,
|
||||
key => $sshkeys,
|
||||
user => $title,
|
||||
type => 'ssh-rsa',
|
||||
}
|
||||
|
||||
if ( $old_keys != [] ) {
|
||||
ssh_authorized_key { $old_keys:
|
||||
ensure => absent,
|
||||
user => $title,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# vim:sw=2:ts=2:expandtab:textwidth=79
|
Loading…
x
Reference in New Issue
Block a user