Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1402282
  • 博文数量: 269
  • 博客积分: 3602
  • 博客等级: 中校
  • 技术积分: 4535
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-17 21:13
文章分类

全部博文(269)

文章存档

2014年(8)

2013年(139)

2012年(122)

分类: 系统运维

2013-04-22 11:44:06

site.pp文件配置实例:

一、添加用户及用户组

class test_class {

group { "test":
   gid => 2222,
   ensure =>present;  
}

user { "test":
         uid => 2222,
         gid => 2222,
         password =>'$1$Q4elAs8J$Fdi8GtbxZoHRWAJrmRSa7/',
         shell =>"/bin/bash",
         managehome =>"ture",
         require => Group["test"];
}


file {   "/home/test":
           owner   => 2222,
           group   => 2222,
           mode    => 711,
           ensure => directory,
           require => User["test"];
       }


exec { "userhome":
    command => "cp /etc/skel/.* /home/test/",
    cwd => "/tmp",
    path => ["/usr/bin", "/usr/sbin","/bin"],
    require => File["/home/test"];
    }


#file
#       {"/etc/sudoers":
#       owner => root,
#       group => root,
#       mode => 600,
#//需要把提前修改后的文件拷贝到文件服务器的位置
#       source=> "puppet://puppet/files/sudoers";
#       }

 


}
# tell puppet on which client to run the class
node changzheng{
include test_class
}


二、修改用户密码

class test_class {

user { "test":
         password =>'$1$159tPW3i$oLadwa1iSxkrV8I0S9bSn1'; #这里的密码为000000,linux用户密码加密如果不会算,就直接passwd一个测试用户,然后通过查看/etc/shadow

获取。这里password必须要用单引号,因为还有$字符。
}
}
# tell puppet on which client to run the class
node changzheng{
include test_class
}


更多实例:

另外,可以引入外部的manifests配置文件
在site.pp开始的部分可以通过
import "node1.pp"
import "node2.pp"
...
这样就可以对不同客户端进行相关的配置了。

阅读(1266) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~