Browse Source

Merge pull request #6 from hatifnatt/master

Pull changes from main repo.
lookup-fix-3
Roman 9 years ago
parent
commit
c2abcabb7e
3 changed files with 16 additions and 9 deletions
  1. +1
    -0
      pillar.example
  2. +15
    -3
      users/init.sls
  3. +0
    -6
      users/sudo.sls

+ 1
- 0
pillar.example View File

33333333 33333333
44444444 44444444
55555555 55555555
uid: 1001


user_files: user_files:
enabled: True enabled: True

+ 15
- 3
users/init.sls View File



{% for group in user.get('groups', []) %} {% for group in user.get('groups', []) %}
users_{{ name }}_{{ group }}_group: users_{{ name }}_{{ group }}_group:
group:
group.present:
- name: {{ group }} - name: {{ group }}
- present
{% if group == 'sudo' %}
- system: True
{% endif %}
{% endfor %} {% endfor %}


users_{{ name }}_user: users_{{ name }}_user:
- createhome: False - createhome: False
{% endif %} {% endif %}
{% if 'expire' in user -%} {% if 'expire' in user -%}
{% if grains['kernel'].endswith('BSD') and
user['expire'] < 157766400 %}
{# 157762800s since epoch equals 01 Jan 1975 00:00:00 UTC #}
- expire: {{ user['expire'] * 86400 }}
{% elif grains['kernel'] == 'Linux' and
user['expire'] > 84006 %}
{# 2932896 days since epoch equals 9999-12-31 #}
- expire: {{ (user['expire'] / 86400) | int}}
{% else %}
- expire: {{ user['expire'] }} - expire: {{ user['expire'] }}
{% endif %}
{% endif -%} {% endif -%}
- remove_groups: {{ user.get('remove_groups', 'False') }} - remove_groups: {{ user.get('remove_groups', 'False') }}
- groups: - groups:
file.managed: file.managed:
- name: {{ home }}/.ssh/authorized_keys - name: {{ home }}/.ssh/authorized_keys
- user: {{ name }} - user: {{ name }}
- group: {{ name }}
- group: {{ user_group }}
- mode: 600 - mode: 600
{% if 'ssh_auth_file' in user %} {% if 'ssh_auth_file' in user %}
- contents: | - contents: |

+ 0
- 6
users/sudo.sls View File

pkg.installed: pkg.installed:
- name: {{ users.bash_package }} - name: {{ users.bash_package }}


users_sudo-group:
group.present:
- name: sudo
- system: True

users_sudo-package: users_sudo-package:
pkg.installed: pkg.installed:
- name: {{ users.sudo_package }} - name: {{ users.sudo_package }}
- require: - require:
- group: users_sudo-group
- file: {{ users.sudoers_dir }} - file: {{ users.sudoers_dir }}


users_{{ users.sudoers_dir }}: users_{{ users.sudoers_dir }}:

Loading…
Cancel
Save