Puppet User Module

Source: Internet
Author: User
Tags require

Requirements are as follows:

The existing server A,b,c three, the user dev1,dev2,dev3 belong to the dev group, the user sa1,sa2,sa3 belong to wheel group;

User dev1 can log on to server A, and dev2,dev3 can not login, and wheel members can log in;

The same server B only allows users dev2 and wheel members to log in, Server C allows only dev3 and wheel members to log in;

The architecture is as follows:

The relevant documents are as follows:

1,init.pp class User {include User::adduser import ' deluser.pp '} 2,addus     
        Er.pp class User::adduser {@user {"Dev1": #dev2, dev3 similar to ensure =>, present, Shell => "/bin/bash", tag => [' Dev '], groups => Dev, require =&gt ;     
         
      group[' Dev '], managehome => true, password => ' $SAWERADF 123 ',}     
        @user {"SA1": #sa2, sa3 similar to ensure => present, Shell => "/bin/bash",   Tag => [' sa], groups => dev, require => group[' wheel '], managehome => true, password => ' Werae$aer12 ',} group {"Dev": Ensu    
        Re => present,} 3,deluser.pp define User::d Eluser ($username  )    
        {  
          User {"$username": Ensure => absent,} file {"/home/$username": Ensure => absent,}}

Note that puppet also supports SSH key authentication, you can go to the official website to see, here or with the password

Use the following methods:

Node ' Server1 ' {    
        include user        
        realize user[' Dev1 ']     # # Create Dev1    
        
        user individually::d eluser{"Userdel sa1":   # # Delete SA1      
          username  => SA1,    
        }    
        
        User <| groups = Wheel |>  # #创建所有wheel成员    
}    
        
premises Remember Or are you going to import "user" inside the modules.pp?

GitHub Address: Https://github.com/vTNT/puppet-user is not updated regularly--

Source: http://tntdba.blog.51cto.com/1199791/1181968

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.