1检查*.pp文件的语法
[root@NewBieSlave2 ~]# cat /etc/puppet/manifests/install_ntpdate
[root@node1 ~]# vi test.pp
package {'ntpdate':
ensure => true, #确保ntpdate是被安装的
}
[root@NewBieSlave2 ~]# puppet parser validate /etc/puppet/manifests/install_ntpdate
Error: Could not parse for environment production: Syntax error at '['; expected ']' at /etc/puppet/manifests/install_ntpdate:1
[root@NewBieSlave2 ~]# cat /etc/puppet/manifests/install_ntpdate
package {'ntpdate':
ensure => true, #确保ntpdate是被安装的
}
[root@NewBieSlave2 ~]# puppet parser validate /etc/puppet/manifests/install_ntpdate
[root@NewBieSlave2 ~]#
2)查看帮助
[root@NewBieSlave2 ~]# puppet help
Usage: puppet <subcommand> [options] <action> [options]
Available subcommands:
agent The puppet agent daemon
apply Apply Puppet manifests locally
。。。
See 'puppet help <subcommand> <action>' for help on a specific subcommand action.
See 'puppet help <subcommand>' for help on a specific subcommand.
Puppet v3.6.2
3)确保软件 是安装的
[root@NewBieSlave2 ~]# cat /etc/puppet/manifests/install_ntpdate
package {'ntpdate':
ensure => true, #确保ntpdate是被安装的
}
[root@NewBieSlave2 ~]# puppet apply /etc/puppet/manifests/install_ntpdate
Notice: Compiled catalog for newbieslave2 in environment production in 0.52 seconds
Warning: The package type's allow_virtual parameter will be changing its default value from false to true in a future release. If you do not want to allow virtual packages, please explicitly set allow_virtual to false.
(at /usr/share/ruby/vendor_ruby/puppet/type.rb:816:in `set_default')
Notice: /Stage[main]/Main/Package[ntpdate]/ensure: ensure changed '4.2.6p5-29.el7.centos.2' to 'true'
Notice: Finished catalog run in 6.34 seconds
[root@NewBieSlave2 ~]#