Skip to content

Instantly share code, notes, and snippets.

@zapman449
Last active December 21, 2015 11:38
Show Gist options
  • Save zapman449/6300375 to your computer and use it in GitHub Desktop.
Save zapman449/6300375 to your computer and use it in GitHub Desktop.
#
define bastion_users (
$id,
$homedir = "/home/${name}",
$comment = '',
) {
#$authorized_key,
#$ssh_config,
#$private_key,
#$public_key,
group { $name:
ensure => present,
name => $name,
gid => $id,
}
user { $name:
ensure => present,
name => $name,
password => '!!',
uid => $id,
gid => $name,
comment => $comment,
homedir => $homedir,
provider => 'useradd',
managehome => true,
shell => '/bin/bash',
}
file { "/home/${name}/.ssh":
ensure => directory,
group => $name,
owner => $name,
mode => '0700',
}
file { "/home/${name}/.ssh/authorized_keys":
ensure => present,
source => "puppet://modules/bastion_users/${name}_authorized_keys",
path => "/home/${name}/.ssh/authorized_keys",
group => $name,
owner => $name,
mode => 0600,
}
file { '/home/${name}/.ssh/config':
ensure => 'present',
source => "puppet:///modules/bastion_users/${name}_ssh_config",
path => "/home/${name}/.ssh/config",
group => $name,
owner => $name,
mode => '0600',
}
file { "/home/${name}/.ssh/id_rsa":
ensure => present,
source => "puppet:///modules/bastion_users/${name}2_rsa",
path => "/home/${name}/.ssh/id_rsa",
group => $name,
owner => $name,
mode => '0600',
}
file { "/home/${name}/.ssh/id_rsa.pub":
ensure => present,
source => "puppet:///modules/bastion_users/${name}2_rsa.pub",
path => "/home/${name}/.ssh/id_rsa.pub",
group => $name,
owner => $name,
mode => '0644',
}
}
create_resources('module::bastion_users', $users)
$users = { "fod_admin" : { id => 12456 },
"mysql_admin" : { id => 12454 },
"gdicast_admin" : { id => 12453 },
"puppet_admin" : { id => 12450 },
"dpe_admin" : { id => 12449 },
"oapi_admin" : { id => 12448 },
"iapi_admin" : { id => 12447 },
"mongo_admin" : { id => 12446 },
"rmq_admin" : { id => 12405 },
"redis_admin" : { id => 12403 },
"zabbix_admin" : { id => 12402 },
"riak_admin" : { id => 12401 },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment