added common settings

This commit is contained in:
=
2020-12-22 11:46:20 +01:00
parent 864c02a77b
commit caf47ab94f
8 changed files with 361 additions and 0 deletions

13
common/groups.sls Normal file
View File

@@ -0,0 +1,13 @@
{% if pillar['groups'] is defined %}
{% for group, args in pillar['groups'].items() %}
Added {{ group }} group:
group.present:
- name: {{ group }}
{% if args['gid'] is defined %}
- gid: {{ args['gid'] }}
{% endif %}
{%if args['system'] is defined %}
- system: {{ args['system'] }} %}
{% endif %}
{% endfor %}
{% endif %}

38
common/users.sls Normal file
View File

@@ -0,0 +1,38 @@
{% for user, args in pillar['users'].items() %}
# remove users
{% if args['remove'] is defined %}
{{ user }}:
user.absent
{% if 'alias_target' in args %}
alias.present:
- target: {{ args['alias_target'] }}
{% endif %}
{% else %}
# add users
{{ user }}:
user.present:
- fullname: {{ args['fullname'] | default('') }}
- home: {{ args['home'] | default('/home/'+user) }}
- shell: {{ args['shell'] | default('/bin/bash') }}
{% if args['uid'] is defined %}
- uid: {{ args['uid'] }}
{% endif %}
- password: {{ args['password'] }}
- enforce_password: {{ args['enforce_password'] | default('True') }}
{% if 'groups' in args %}
- groups: {{ args['groups'] }}
{% endif %}
{% if 'alias_target' in args %}
alias.present:
- target: {{ args['alias_target'] }}
{% endif %}
{% if 'ssh_auth' in args %}
{{ user }}_autherized_keys:
ssh_auth:
- present
- user: {{ user }}
- names: {{ args['ssh_auth'] }}
{% endif %}
{% endif %}
{% endfor %}