puppet中的正则表达式的匹配
- $operatingsystem =~ /(?i-mx:(macox|majaro|debain|gentoo))
- 上述表达的说明
- $operatingsystem是puppet的内置变量
- =~ 是字符串的模式匹配
- 其中/(?i-mx:
- 此
自定义模块
创建一个module_name目录, 在该目录中包含manifests, lib, tests, spec, files, templates目录, 其中在manifests中放的文件是.pp文件, 且和python一样有类似的要求, 需要有一个init.pp文件, 并且在该文件中需要定义一个class, 他的class name需要和module_name一致
下面为一个简单的示例
nginx/
|-- files # 放置普通的文件
|-- lib
|-- manifests # 放置.pp文件
| `-- init.pp
|-- spec
|-- templates # 放置嵌入ruby脚本的plain text, 就是里面有 <%= %>等标志的文件
| `-- nginx.conf
`-- tests