Search code examples
pythonsalt-project

Salt stack: Create user and group with same name


I am trying to create a user and a group on multiple linux servers with the same name, nagios.

I have this block of code:

nagios:
  group:
    - present
  user:
    - present
    - fullname: Nagios System Monitoring
    - shell: /bin/bash
    - home: /opt/nagios

The group gets created properly, but the user does not and I can't get salt to tell me why.


Solution

  • From the docs http://docs.saltstack.com/en/latest/ref/states/all/salt.states.user.html

    user.present:
      - gid_from_name
        If True, the default group id will be set to the 
        id of the group with the same name as the user, Default is False.
    

    Also, generally, you can get better debug output by ssh'ing into the target minion and running the state via salt-call with or without -l debug.