Saltstack Bulk Add Bulk Delete users

Source: Internet
Author: User
Tags saltstack

Bulk Add Users

[email protected] init]# cat Useradds.sls
{% Set users = [' name1,name2 ']%}
{% for user in users%}
{{User}}:
User.present:
-Shell:/bin/bash
-Home:/home/{{User}}
-Password: ' $1$sbvwg7.v$r/nwds7g0yynb1cvsfupa/'
-Groups:
-{{User}}
-Require:
-Group: {{User}}
Group.present:
-Name: {{User}}
{% ENDFOR%}


Password is the password after the hash
Get hash password for ciphertext after OpenSSL passwd-1
[email protected] init]# OpenSSL passwd-1
Password:
Verifying–password:
$1$bwsi2gyh$v.jqn/fe9j3yltwxco.cq/


Bulk Delete Users

[email protected] init]# cat Userdel.sls
{% Set users = [' Jerry ', ' Tom ', ' Sunday ']%}
{% for user in users%}
{{User}}:
User.absent:
-Purge:true
-Force:true
{% ENDFOR%}


-Purge:true # #Set purge to True to delete all of the user's files as well as the user, and Default is False.
-Force:true # #如果用户当前已登录, the absent state fails. When the force option is set to True, the user is deleted even if the user is currently logged on.

This article is from the "yangspring" blog, please be sure to keep this source http://ycccc.blog.51cto.com/6385403/1715923

Saltstack Bulk Add Bulk Delete users

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.