Hi Peter,
The all_users variable is set when we use SaltStack to list all users in the current environment by using the 'user.list_users' salt command (
{% set all_users = salt['user.list_users']() %})
If the name provided by the pillar above it ({% set user = salt['pillar.get']('bitcurator_user', 'bcadmin') %}) or provided by the --user option in the bitcurator-cli exists in that list of users, then the remainder of the state only confirms / sets the Name and Home directory of the user, it does not try to change the GID.
This also includes the basic "sudo bitcurator install" as the current running user is passed as the bitcurator_user pillar when none is selected.
{% if user in all_users %}
bitcurator-user-{{ user }}:
user.present:
- name: {{ user }}
- home: {{ home }}
{% else %}
If the user does NOT exist (as in not in the list of all users on the system), then the else statement is triggered and the user is to be created.
From the original log, the user was set to be created because the current user did not exist in the list of users. As such, the currently logged in and running user did not have the
authority to create a user with a specific group, likely due to their AD
credentials not having sufficient privilege.
bitcurator-user-[USERNAME REDACTED]:
group.present:
- name: [USERNAME REDACTED]
user.present:
- name: [USERNAME REDACTED]
- gid: [USERNAME REDACTED]
- fullname: BitCurator
- shell: /bin/bash
- home: /home/[USERNAME REDACTED]
- Changing gid (xxxx -> [USERNAME REDACTED]) not permitted, set allow_gid_change to True to force this change. Note that this will not change file ownership.
The issue then becomes, did the user actually exist before the installation, and if so, why wasn't it detected?
Matthew: Can you tell me if the user that you were logged in as was created in AD first, then logged in with the AD credentials, or did the account exist in the VM first, then added to AD?
Also, can you run the following command on your BitCurator system and tell me if the user you're logged in as exists in the list which is returned from the command? I don't need the actual names (as I know they're sensitive), I just need to know if your username exists in the list (yes or no)
The command: salt-call --local users.list_users