Skip to content

Instantly share code, notes, and snippets.

@txomon
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save txomon/cb0351692cc4406281b1 to your computer and use it in GitHub Desktop.
Save txomon/cb0351692cc4406281b1 to your computer and use it in GitHub Desktop.
saltstack repo
machines:
theoden:
owner: javier
guest: True
aragorn:
owner: javier
de: False
frodo:
owner: javier
laptop: True
base:
'*':
- machines
- users
users:
javier:
id: 1000
fullname: Javier Domingo Cansino
sudo: True
shell: /usr/bin/zsh
userone:
id: 1001
fullname: User One
usertwo:
id: 1002
fullname: User Two
userthree:
id: 1003
fullname: User Three
guest:
id: 2000
fullname: Invitado
base:
'*':
- users
{% set machine = pillar.machines.get(grains.nodename, {}) %}
{% if machine %}
{% for usr,attrs in pillar.users.iteritems() %}
{{usr}}:
user:
{% if attrs.get('absent',False) %}
- absent
{% elif usr=='guest' and not machine.get('guest',False) %}
- absent
{% else %}
- present
- fullname: {{ attrs.get('fullname', None) }}
- shell: {{ attrs.get('shell', '/bin/bash') }}
- home: /home/{{ usr }}
- uid: {{ attrs.id }}
- gid: {{ attrs.id }}
- gid_from_name: True
- create_home: True
- groups:
{% if attrs.get('sudo',False) %}
- wheel
{% endif %}
- tty
- uucp
- users
- optional_groups:
- adbusers
- avahi
- locate
{% if machine.get('laptop',False) %}
- rfkill
{% endif %}
{% if machine.get('de',True) %}
- games
- gdm
- networkmanager
- vboxusers
- wireshark
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment