The first thing i did using salt stack was creating a local windows user. Creating users on different OS builds are fully supported by using the built-in salt functions.
First create a mapping in your top.sls config which point to your Windows state directory.
Sample config in top.sls Defining 2 hostnames, one with a wildcard for matching a server group.
base: '*': - generic 'TST02 or TST0*2': - tst.win_generic #This match the following hostnames: TST02 and TST012,TST022,TST032 etc. #The SLS file in folder tst.
Content of the win_generic.sls
tst_user: user.present: - name: TSTUser - groups: - Administrators - Users - fullname: TST Comod - password: {{ pillar['passwords']['TSTUser'] }} - enforce_password: False #More parameters: https://docs.saltstack.com/en/latest/ref/states/all/salt.states.user.html
In this example I use pillar for securing passwords. If you don’t use pillar, just use a plain text password in the password field.
Ill write a blog article how to use Pillar in SALT.
The post Create Windows user using SALTstack appeared first on Rob V IT.