Skip to content

Instantly share code, notes, and snippets.

Created April 19, 2017 13:09
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 anonymous/2ec96ed775bc69cddd17390a9f183179 to your computer and use it in GitHub Desktop.
Save anonymous/2ec96ed775bc69cddd17390a9f183179 to your computer and use it in GitHub Desktop.
trying to add users in salt
testuser:
user.present:
- fullname: testuser
- shell: /bin/bash
- home: /home/testuser
- gid: 700
- uid: 700
- gid_from_name: True
salt '*' state.apply user
results
[root@salt salt]# salt 'minion1.vosko.lab' state.apply users
minion1:
----------
ID: testuser
Function: user.present
Result: True
Comment: New user testuser created
Started: 15:08:40.203591
Duration: 127.819 ms
Changes:
----------
fullname:
testuser
gid:
1006
groups:
- testuser
home:
/home/testuser
homephone:
name:
testuser
passwd:
x
roomnumber:
shell:
/bin/bash
uid:
700
workphone:
Summary for minion1
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
Total run time: 127.819 ms
@lietu
Copy link

lietu commented Apr 19, 2017

Try something like this

testuser:
  group.present:
    - gid: 700
  user.present:
    - fullname: testuser
    - shell: /bin/bash
    - home: /home/testuser
    - gid: testuser
    - uid: 700
    - require:
      - group: testuser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment