updated users / zsh states after users structure changes

This commit is contained in:
Paul 2022-06-08 23:48:21 +02:00
parent 2b1faf1daa
commit 4cb3cc6d49
8 changed files with 29 additions and 25 deletions

View File

@ -1,3 +1,3 @@
---
users: []
groups: []
users: {}
groups: {}

View File

@ -1,12 +1,12 @@
---
{%- from "users/map.jinja" import groups with context -%}
{%- for group in groups %}
group-{{ group.name }}:
{%- for name,group in groups.items() %}
group-{{ name }}:
{%- if group.enabled %}
group.present:
{%- else %}
group.absent:
{%- endif %}
- name: {{ group.name }}
- name: {{ name }}
{% endfor %}

View File

@ -1,16 +1,16 @@
---
{%- from "users/map.jinja" import users with context -%}
{%- for user in users %}
{%- for username,user in users.items() %}
{%- if user.sshkeys is defined %}
{%- for key in user.sshkeys %}
ssh-key-{{ user.name }}-{{ key.name }}:
ssh-key-{{ username }}-{{ key.name }}:
ssh_auth.{{ key.state }}:
- user: {{ user.name }}
- user: {{ username }}
- names:
- {{ key.value }}
- require:
- user: user-{{ user.name }}
- user: user-{{ username }}
{% endfor %}
{%- endif -%}
{% endfor %}

View File

@ -1,18 +1,18 @@
---
{%- from "users/map.jinja" import users with context -%}
{%- for user in users %}
{%- for name, user in users.items() %}
{%- if not user.enabled %}
user-{{ user.name }}:
user-{{ name }}:
user.absent:
- name: {{ user.name }}
- name: {{ name }}
{%- endif %}
{%- if user.enabled %}
user-{{ user.name }}:
user-{{ name }}:
user.present:
- name: {{ user.name }}
- name: {{ name }}
- fullname: {{ user.fullname }}
- shell: {{ user.shell }}
- home: {{ user.home }}

View File

@ -3,4 +3,4 @@
{%- set defaults = salt['grains.filter_by'](default_settings, default='zsh') -%}
{%- set zsh = salt['pillar.get']('zsh', default=defaults, merge=True) -%}
{%- set users = salt['pillar.get']('users', default=defaults, merge=True) -%}
{%- set users = salt['pillar.get']('users') -%}

View File

@ -1,17 +1,17 @@
---
{%- from "zsh/map.jinja" import users with context %}
{%- for user in users %}
{%- for name, user in users.items() %}
{%- if user.enabled %}
zshrc-user-{{ user.name }}:
zshrc-user-{{ name }}:
file.managed:
- name: {{ user.home }}/.zshrc
- source: salt://zsh/zshrc.j2
- user: {{ user.name }}
- user: {{ name }}
- group: {{ user.gid }}
- mode: 0644
- template: jinja
- require:
- pkg: zsh-pkg
- user: user-{{ user.name }}
- user: user-{{ name }}
{%- endif %}
{%- endfor %}

View File

@ -53,7 +53,11 @@ then
source $ZSH/oh-my-zsh.sh
fi
alias vim=nvim
# Neovim aliases
for i in v vi vim
do
alias $i=nvim
done
alias weather="curl -s wttr.in/caen"
# Misc settings