saltstack添加一个Linux用户

官网地址:https://docs.saltstack.com/en/latest/ref/states/all/salt.states.user.html

状态文件user.sls:

useradd:
  group.present:
    - name: hthx
    - gid: 1000

  user.present:
    - name: hthx
    - fullname: hthx
    - uid: 1000
    - gid: 1000
    - home: /home/hthx
    - shell: /bin/bash
    - groups:
      - hthx
    - unique: True
    - password: '$1$gKBCvdRz$UiFWG4g5Nxk651jUpbNX0.'
    - enforce_password: False

用户的密码是加密过后的密码,这里通过openssl加密:

[root@salt-master init]# openssl passwd -1
Password:
Verifying - Password:
$1$yZX/9PLG$qxmRn/vZ58ownUEWrOOnw.                #<==设置密码123456,生成后的字符串

猜你喜欢

转载自www.cnblogs.com/liuguangjiji/p/10582143.html