Skip to content

Commit 18c5d9e

Browse files
Merge branch 'master' into policykit-settings
2 parents b84e79b + d4f8cf9 commit 18c5d9e

10 files changed

Lines changed: 294 additions & 45 deletions

File tree

README.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,25 @@ True' in pillar per user. Defaults to False.
4545

4646
Ensures the vimrc file exists in the users home directory. Sets 'manage_vimrc:
4747
True' in pillar per user. Defaults to False.
48-
This depends on the vim-formula to be installed.
48+
This depends on the vim-formula being available and pillar `users:use_vim_formula: True`.
4949

5050
``users.user_files``
5151
---------------
5252

5353
Permits the abitrary management of files. See pillar.example for configuration details.
54+
55+
Overriding default values
56+
=========================
57+
58+
In order to separate actual user account definitions from configuration the pillar ``users-formula`` was introduced:
59+
60+
.. code-block:: yaml
61+
62+
users:
63+
myuser:
64+
# stuff
65+
66+
users-formula:
67+
lookup:
68+
root_group: toor
69+
shell: '/bin/zsh'

pillar.example

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1+
users-formula:
2+
use_vim_formula: True
3+
lookup: # override the defauls in map.jinja
4+
root_group: root
5+
6+
# group initialization
7+
groups:
8+
foo:
9+
state: present
10+
gid: 500
11+
system: False
12+
113
users:
214
## Minimal required pillar values
315
auser:
416
fullname: A User
517

618
## Full list of pillar values
19+
allow_gid_change: False
720
buser:
821
fullname: B User
922
password: $6$w.............
@@ -22,9 +35,13 @@ users:
2235
workphone: "(555) 555-5555"
2336
homephone: "(555) 555-5551"
2437
manage_vimrc: False
38+
allow_gid_change: True
2539
manage_bashrc: False
2640
manage_profile: False
2741
expire: 16426
42+
# Disables user management except sudo rules.
43+
# Useful for setting sudo rules for system accounts created by package instalation
44+
sudoonly: False
2845
sudouser: True
2946
# sudo_rules doesn't need the username as a prefix for the rule
3047
# this is added automatically by the formula.
@@ -55,6 +72,13 @@ users:
5572
ssh_keys:
5673
privkey: PRIVATEKEY
5774
pubkey: PUBLICKEY
75+
# or you can provide path to key on Salt fileserver
76+
privkey: salt://path_to_PRIVATEKEY
77+
pubkey: salt://path_to_PUBLICKEY
78+
# you can provide multiple keys, the keyname is taken as filename
79+
# make sure your public keys suffix is .pub
80+
foobar: PRIVATEKEY
81+
foobar.pub: PUBLICKEY
5882
# ... or you can pull them from a different pillar,
5983
# for example one called "ssh_keys":
6084
ssh_keys_pillar:
@@ -75,10 +99,18 @@ users:
7599
# than inline in pillar, this works.
76100
ssh_auth_sources:
77101
- salt://keys/buser.id_rsa.pub
102+
ssh_auth_sources.absent:
103+
- salt://keys/deleteduser.id_rsa.pub # PUBLICKEY_FILE_TO_BE_REMOVED
78104
# Manage the ~/.ssh/config file
79105
ssh_known_hosts:
80106
importanthost:
107+
port: 22
81108
fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
109+
key: PUBLICKEY
110+
enc: ssh-rsa
111+
hash_known_hosts: True
112+
timeout: 5
113+
fingerprint_hash_type: sha256
82114
ssh_known_hosts.absent:
83115
- notimportanthost
84116
ssh_config:
@@ -98,7 +130,11 @@ users:
98130
gitconfig:
99131
user.name: B User
100132
user.email: buser@example.com
101-
url."https://".insteadOf: "git://"
133+
"url.https://.insteadOf": "git://"
134+
135+
gitconfig.absent:
136+
- push.default
137+
- color\..+
102138

103139
google_2fa: True
104140
google_auth:
@@ -113,6 +149,8 @@ users:
113149
33333333
114150
44444444
115151
55555555
152+
# unique: True allows user to have non unique uid
153+
unique: False
116154
uid: 1001
117155

118156
user_files:
@@ -121,6 +159,13 @@ users:
121159
# should be a salt fileserver path either with or without 'salt://'
122160
# if not present, it defaults to 'salt://users/files/user/<username>
123161
source: users/files/default
162+
template: jinja
163+
# You can specify octal mode for files and symlinks that will be copied. Since version 2016.11.0
164+
# it's possible to use 'keep' for file_mode, to preserve file original mode, thus you can save
165+
# execution bit for example.
166+
file_mode: keep
167+
sym_mode: 640
168+
exclude_pat: "*.gitignore"
124169

125170
## Absent user
126171
cuser:
@@ -133,3 +178,17 @@ users:
133178
absent_users:
134179
- donald
135180
- bad_guy
181+
182+
groups:
183+
badguys:
184+
absent: True
185+
niceguys:
186+
gid: 4242
187+
system: False
188+
addusers: root
189+
delusers: toor
190+
ssl-cert:
191+
system: True
192+
members:
193+
- www-data
194+
- openldap

users/bashrc.sls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ users_{{ name }}_user_bashrc:
2121
- user: {{ name }}
2222
- group: {{ user_group }}
2323
- mode: 644
24-
- source:
24+
- template: jinja
25+
- source:
2526
- salt://users/files/bashrc/{{ name }}/bashrc
2627
- salt://users/files/bashrc/bashrc
2728
{% endif %}

users/defaults.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
4+
users-formula:
5+
use_vim_formula: False
6+
7+
users:
8+
allow_gid_change: True
9+
createhome: True
10+

0 commit comments

Comments
 (0)