Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F25244011
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/map.jinja b/map.jinja
index 482ed94..18a2282 100644
--- a/map.jinja
+++ b/map.jinja
@@ -1,23 +1,36 @@
{% set dirs = salt['grains.filter_by']({
'Debian': {
'etc': '/etc',
'bin': '/usr/bin',
'include': '/usr/include',
'lib': '/usr/lib',
},
'FreeBSD' : {
'etc': '/usr/local/etc',
'bin': '/usr/local/bin',
'include': '/usr/local/include',
'lib': '/usr/local/lib',
},
}, default='Debian') %}
{% set services = salt['grains.filter_by']({
'Debian': {
'manager': 'systemd',
},
'FreeBSD' : {
'manager': 'rc',
},
}, default='Debian') %}
+
+{% set shells = salt['grains.filter_by']({
+ 'Debian': {
+ 'bash': '/bin/bash',
+ 'fish': '/usr/bin/fish',
+ 'tcsh': '/usr/bin/tcsh',
+ },
+ 'FreeBSD' : {
+ 'bash': '/usr/local/bin/bash',
+ 'fish': '/usr/local/bin/fish',
+ 'tcsh': '/bin/tcsh',
+ },
+}, default='Debian') %}
diff --git a/pillar/users/shellusers.sls b/pillar/users/shellusers.sls
index c2b1c3b..18674b3 100644
--- a/pillar/users/shellusers.sls
+++ b/pillar/users/shellusers.sls
@@ -1,89 +1,81 @@
# -------------------------------------------------------------
# Salt — Users accounts list
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Eglide
# Created: 2016-04-08
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# -------------------------------------------------------------
# Users accounts
# -------------------------------------------------------------
shellusers:
tomjerr:
fullname: Tommy Aditya
uid: 2001
erol:
fullname: Erol Unutmaz
uid: 2002
rashk0:
fullname: Rashk0
uid: 2003
kazuya:
fullname: Kazuya
uid: 2004
amj:
fullname: Amaury J.
uid: 2005
dereckson:
fullname: Sebastien Santoro
- {% if grains['os'] == 'FreeBSD' %}
- shell: /bin/tcsh
- {% else %}
- shell: /usr/bin/tcsh
- {% endif %}
+ shell: tcsh
uid: 5001
sandlayth:
fullname: Yassine Hadj Messaoud
uid: 5002
shark:
fullname: Shark
uid: 2006
rix:
fullname: Rix
uid: 2007
kumkum:
fullname: Kumkum
uid: 2008
chan:
fullname: Chanel
uid: 2009
ringa:
fullname: Ringa
uid: 2010
xray:
fullname: xray
uid: 2011
c2c:
fullname: c2c
- {% if grains['os'] == 'FreeBSD' %}
- shell: /usr/local/bin/fish
- {% else %}
- shell: /usr/bin/fish
- {% endif %}
+ shell: fish
uid: 2012
rama:
fullname: Rama
uid: 2013
thrx:
fullname: ThrX
uid: 2014
xcombelle:
fullname: xcombelle
uid: 2017
hlp:
fullname: hlp
uid: 2018
axe:
fullname: axe
uid: 2019
harshcrop:
fullname: Harsh Shah
uid: 2020
ariel:
fullname: ariel
uid: 2021
pkuz:
fullname: PK of UZ
uid: 2022
diff --git a/roles/shellserver/users/init.sls b/roles/shellserver/users/init.sls
index 7cde92f..078a0af 100644
--- a/roles/shellserver/users/init.sls
+++ b/roles/shellserver/users/init.sls
@@ -1,91 +1,93 @@
# -------------------------------------------------------------
# Salt — Provision users accounts
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Eglide
# Created: 2016-04-08
# 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
# :: Managed SSH keys
#
# -------------------------------------------------------------
+{% from "map.jinja" import shells with context %}
+
# -------------------------------------------------------------
# Disabled accounts
# -------------------------------------------------------------
{% for user in pillar.get('revokedusers') %}
{{user}}:
user.absent
{% endfor %}
# -------------------------------------------------------------
# Active accounts
# -------------------------------------------------------------
{% for user, args in pillar.get('shellusers', {}).iteritems() %}
{{user}}:
user.present:
- fullname: {{ args['fullname'] }}
- - shell: {{ args['shell']|default('/bin/bash') }}
+ - shell: {{ shells[args['shell']|default('bash')] }}
- uid: {{ args['uid'] }}
{% endfor %}
# -------------------------------------------------------------
# Groups
# -------------------------------------------------------------
shell:
group.present:
- system: True
- gid: 200
- members:
{% for user, args in pillar.get('shellusers', {}).iteritems() %}
- {{user}}
{% endfor %}
{% for group, args in pillar.get('shellgroups', {}).iteritems() %}
group_{{group}}:
group.present:
- name: {{group}}
- system: False
- gid: {{ args['gid'] }}
- members: {{ args['members'] }}
{% endfor %}
{% if salt['group.info']('root') and salt['group.info']('root')['gid'] == 0 %}
rename_root_group_to_wheel:
cmd.run:
- name: sed -i 's/root:x:0:/wheel:x:0:/' /etc/group
{% endif %}
wheel:
group.present:
- system: True
- gid: 0
- members:
{% for user in pillar.get('shelladmins') %}
- {{user}}
{% endfor %}
# -------------------------------------------------------------
# Managed SSH keys
# -------------------------------------------------------------
{% for user, args in pillar.get('shellusers', {}).iteritems() %}
sshkey_{{user}}:
ssh_auth.present:
- user: {{user}}
- source: salt://roles/shellserver/users/files/ssh_keys/{{user}}
{% endfor %}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Apr 9, 02:20 (6 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3603793
Default Alt Text
(5 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment