puppet的脚本语法参照:
https://docs.puppetlabs.com/puppet/4.4/reference/lang_visual_index.html
比如你创建一个用户,如果用shell脚本可能是:
useradd -u 1000 -g 1000 testuser
但是一个用户的控制层面有很多,例如他的组、home目录等等,如果你在这个脚本中都体现出来,就会很复杂,而且不能成为模块
puppet来写这个东西,可以是:
user { 'root':
ensure => 'present',
comment => 'root',
gid => '0',
home => '/root',
password => '$6$PmuOAD0S30X/0bUY$aCn5/4EFZ1oh1CcyX059yk2fnexNuk.igPth/9OSP5ScUKfKGcWj4xWIur26Lm7N1iOCN7rBKEHUcgwhrfw6l.',
password_max_age => '99999',
password_min_age => '0',
shell => '/bin/bash',
uid => '0',
}
这个描述可以和你的“程序”分开,能够模块化,能够复用
收起