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: [] users: {}
groups: [] groups: {}

View File

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

View File

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

View File

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

View File

@ -5,4 +5,4 @@ zsh:
minimal: false minimal: false
golang: true golang: true
rust: true rust: true
android: false android: false

View File

@ -3,4 +3,4 @@
{%- set defaults = salt['grains.filter_by'](default_settings, default='zsh') -%} {%- set defaults = salt['grains.filter_by'](default_settings, default='zsh') -%}
{%- set zsh = salt['pillar.get']('zsh', default=defaults, merge=True) -%} {%- 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 %} {%- from "zsh/map.jinja" import users with context %}
{%- for user in users %} {%- for name, user in users.items() %}
{%- if user.enabled %} {%- if user.enabled %}
zshrc-user-{{ user.name }}: zshrc-user-{{ name }}:
file.managed: file.managed:
- name: {{ user.home }}/.zshrc - name: {{ user.home }}/.zshrc
- source: salt://zsh/zshrc.j2 - source: salt://zsh/zshrc.j2
- user: {{ user.name }} - user: {{ name }}
- group: {{ user.gid }} - group: {{ user.gid }}
- mode: 0644 - mode: 0644
- template: jinja - template: jinja
- require: - require:
- pkg: zsh-pkg - pkg: zsh-pkg
- user: user-{{ user.name }} - user: user-{{ name }}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}

View File

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