Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F28579176
init.sls
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
init.sls
View Options
# -------------------------------------------------------------
# Salt — Provision users accounts
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2017-11-09
# Description: Adds and revokes user accounts, in the relevant
# groups and with their stable SSH keys.
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# -------------------------------------------------------------
# Table of contents
# -------------------------------------------------------------
#
# :: Disabled accounts
# :: Active accounts
# :: Groups
# :: SSH keys
#
# -------------------------------------------------------------
{%
from
"map.jinja"
import
shells
with context
%}
# -------------------------------------------------------------
# Disabled accounts
# -------------------------------------------------------------
{%
for
username
in
pillar.get
(
'revokedusers'
)
%}
{{
username
}}
:
user.absent
{%
endfor
%}
# -------------------------------------------------------------
# Active accounts
# -------------------------------------------------------------
{%
for
username
,
user
in
salt
[
'forest.get_users'
]()
.items
()
%}
{{
username
}}
:
user.present
:
-
fullname
:
{{
user
[
'fullname'
]
}}
-
shell
:
{{
shells
[
user
[
'shell'
]|
default
(
'bash'
)]
}}
-
uid
:
{{
user
[
'uid'
]
}}
{%
endfor
%}
# -------------------------------------------------------------
# Groups
# -------------------------------------------------------------
{%
for
groupname
,
group
in
salt
[
'forest.get_groups'
]()
.items
()
%}
group_
{{
groupname
}}
:
group.present
:
-
name
:
{{
groupname
}}
-
gid
:
{{
group
[
'gid'
]
}}
-
members
:
{{
group
[
'members'
]
}}
{%
endfor
%}
# -------------------------------------------------------------
# SSH keys
# -------------------------------------------------------------
{%
for
username
,
user
in
salt
[
'forest.get_users'
]()
.items
()
%}
/home/
{{
username
}}
/.ssh
:
file.directory
:
-
user
:
{{
username
}}
-
group
:
{{
username
}}
-
dir_mode
:
700
/home/
{{
username
}}
/.ssh/authorized_keys
:
file.managed
:
-
source
:
salt://roles/core/users/files/authorized_keys
-
user
:
{{
username
}}
-
group
:
{{
username
}}
-
mode
:
600
-
template
:
jinja
-
context
:
keys
:
{{
user
[
'ssh_keys'
]|
default
([])
}}
{%
endfor
%}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 15, 12:05 (1 d, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3688814
Default Alt Text
init.sls (2 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment