This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## user.sls | |
include: | |
- global.zsh | |
root: | |
user.present | |
{% for usr in salt['pillar.get']('users:admins', {}) %} | |
{{ usr }}: | |
group: | |
- present | |
user: | |
- present | |
- gid_from_name: True | |
- groups: | |
{% if grains['os_family'] == 'Debian' %} | |
- sudo | |
- adm | |
- admin | |
{% elif grains['os_family'] == 'RedHat' %} | |
- wheel | |
{% endif %} | |
- createhome: True | |
- shell: /bin/zsh | |
- require: | |
- group: {{ usr }} | |
- sls: global.zsh | |
- prereq_in: | |
- file: {{ usr }}-zshrc | |
{{ usr }}-sshkey: | |
ssh_auth: | |
- present | |
- user: {{ usr }} | |
- source: {{ salt['pillar.get']('ssh_auth:REDACTED_file', '') }} | |
/etc/sudoers.d/99-{{ usr }}-user: | |
file.managed: | |
- source: salt://global/templates/sudoer.jinja | |
- user: root | |
- group: root | |
- mode: 0640 | |
- template: jinja | |
- defaults: | |
user: {{ usr }} | |
{% endfor %} | |
# TODO: fix this on 1st run | |
{% for usr in salt['pillar.get']('users:zsh_users', {}) %} | |
{% set home = salt['cmd.run']("bash -c 'echo ~{0}'".format(usr)) %} | |
{{ usr }}-zshrc: | |
file.symlink: | |
- name: {{ home }}/.zshrc | |
- target: /usr/share/zsh/zshrc | |
- force: True | |
- require: | |
- sls: global.zsh | |
{% endfor %} | |
-- | |
# user.sls (pillar) | |
users: | |
admins: | |
- REDACTED | |
zsh_users: | |
- root | |
- REDACTED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment