常用資源:user group package file service exec cron notify
使用者組資源 使用者資源 建立使用者組app和使用者app,設定使用者密碼,過期時間。
class user-add-app { group { 'app': ensure => present, name => 'app', gid => '102', allowdupe => true, } user { 'app': ensure => present, uid => '501', allowdupe => true, groups => 'app', # 當進行使用者管理的時候,是否同時管理使用者的家目錄。 managehome => true, home => '/home/app', shell => '/bin/bash', #過期時間 expiry => '2016-06-10', password =>'app', } }
删除使用者組app和使用者app class user-del-app{ user { 'delapp': name => 'app', ensure => 'absent', } group { 'delapp': name => 'app', ensure => 'absent', } }
軟體安裝 yum安裝httpd class yum-httpd { yumrepo { "repo163": descr => "163 repo", baseurl => "http://mirrors.163.com/centos/6/os/x86_64/", gpgcheck => "0", enabled => "1"; } package { "httpd": ensure => installed, require => Yumrepo["repo163"]; } }
檔案管理 向用戶端推送本地腳本
[[email protected] puppet]# cat fileserver.conf
[files] path /etc/puppet/files allow * [[email protected] manifests]# ll /etc/puppet/modules/file-put-1/manifests/init.pp -rw-r--r-- 1 root root 184 5月 31 11:02 /etc/puppet/modules/file-put-1/manifests/init.pp class file-put-1 { file { '/root/1.txt': source => 'puppet://master-192.168.9.157.centos.test.com/files/1.txt', owner => 'root', group => 'root', mode => '755' } }
建立軟連接配接 class file-link-1 { file { '/root/2.txt': ensure => 'link', target => '/root/1.txt' } }