Created
November 3, 2016 17:56
-
-
Save moali87/8c5a67a1556aeccbf85702e6ce5dc736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$users = ['david.gonzales', 'akhter.ali', 'sierah.nguon'] | |
$users.each |String $users| { | |
user { $users: | |
ensure => 'present', | |
gid => '500', | |
password_hash => '!!', | |
uid => '500', | |
shell => '/bin/bash'} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Salt
Pillars
users:
akhter.ali:
uid: 500
gid: 500
shell: /bin/bash
password_hash: !!
david.gonzales:
uid: 501
gid: 501
shell: /bin/bash
password_hash: !!
Example state:
#!py
config = {}
def run():
for user, data in salt'pillar.get'.iteritems:
config['user_{0}.format(user)] = {
'user.present': [
{'name': user},
{'uid': data['uid']},
{'gid': data['gid']},
{'shell': data['shell']},
{'password_hash': data['password_hash']}
]
}
Example state2:
{% for user, data in salt'pillar.get'.iteritems %}
user_{{ user }}:
user.present:
name: {{ user }}
uid: {{ data['uid'] }}
gid: {{ data['gid'] }}
shell: {{ data['shell'] }}
password_hash: {{ data['password_hash'] }}