Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jayangshu84/e4b230f0a72b9c4f71075d581590bc41 to your computer and use it in GitHub Desktop.
Save jayangshu84/e4b230f0a72b9c4f71075d581590bc41 to your computer and use it in GitHub Desktop.
Final (simplified) defined type for creating virtual user acounts
# Defined type for creating virtual user accounts
#
define accounts::virtual ($uid,$realname,$pass) {
user { $title:
ensure => 'present',
uid => $uid,
gid => $title,
shell => '/bin/bash',
home => "/home/${title}",
comment => $realname,
password => $pass,
managehome => true,
require => Group[$title],
}
group { $title:
gid => $uid,
}
file { "/home/${title}":
ensure => directory,
owner => $title,
group => $title,
mode => 0750,
require => [ User[$title], Group[$title] ],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment