puppet的常用语法
检查语法错误
puppet parser validate xx.pp
在客户端测试但是不应用
puppet agent --test --noop
基于安全的考虑,使用预签名证书
puppet cert --generate <hostname>
使用如下命令为 client1.example.com 生成预签名证书: puppet cert --generate client1.example.com
Puppet 现在将为客户端 client1.example.com 生成并签署客户端证书。 传输三个所需的文件到新的客户端:包括客户端私钥、客户端证书和 CA 证书。 这三个文件位于: /etc/puppet/ssl/private_keys/client1.example.com.pem
/etc/puppet/ssl/certs/client1.example.com.pem
/etc/puppet/ssl/certs/ca.pem
复制上述三个文件到客户端相应的目录下,Puppet 会自动进行身份验证从而省略证书请求这一步骤。 值得注意的是 Puppet 的 SSL 证书的位置依赖于 puppet.conf 中的 ssldir 设置。
查看帮助
puppet --help #很重要,可以了解puppet的语法,使用
[root@agent1 src]# puppet help Usage: puppet <subcommand> [options] <action> [options] Available subcommands: agent The puppet agent daemon
apply Apply Puppet manifests locally
ca Local Puppet Certificate Authority management.
catalog Compile, save, view, and convert catalogs.
cert Manage certificates and requests
certificate Provide access to the CA for certificate management.
certificate_request Manage certificate requests.
certificate_revocation_list Manage the list of revoked certificates.
config Interact with Puppet's settings.
describe Display help about resource types
device Manage remote network devices
doc Generate Puppet documentation and references
facts Retrieve and store facts.
file Retrieve and store files in a filebucket
filebucket Store and retrieve files in a filebucket
help Display Puppet help.
inspect Send an inspection report
instrumentation_data Manage instrumentation listener accumulated data. DEPRECATED.
instrumentation_listener Manage instrumentation listeners. DEPRECATED.
instrumentation_probe Manage instrumentation probes. Deprecated
key Create, save, and remove certificate keys.
kick Remotely control puppet agent
man Display Puppet manual pages.
master The puppet master daemon
module Creates, installs and searches for modules on the Puppet Forge.
node View and manage node definitions.
parser Interact directly with the parser.
plugin Interact with the Puppet plugin system.
queue Deprecated queuing daemon for asynchronous storeconfigs
report Create, display, and submit reports.
resource The resource abstraction layer shell
resource_type View classes, defined resource types, and nodes from all manifests.
secret_agent Mimics puppet agent.
status View puppet server status. See 'puppet help <subcommand> <action>' for help on a specific subcommand action.
See 'puppet help <subcommand>' for help on a specific subcommand.
Puppet 的 filebucket备份
1,通常使用的办法(官方教材)
cat /etc/puppet/manifests/site.pp
filebucket { 'main':
path => false, # This is required for remote filebuckets.#只在server端备份,client不备份
server => 'puppet.example.com', # Optional; defaults to the configured puppet master.
} File { backup => main, } #全局生效Puppet 对所有的文件执行这样的默认备份策略
说明下path
The path to the local filebucket; defaults to the value of the clientbucketdir setting. To use a remote filebucket, you must set this attribute to false.
path默认是在client里 默认备份是在/var/lib/puppet/clientbucket/里,加上path=false是说明备份在server端
2自定义备份在当前目录下
如下这样在定义文件服务的时候加个:
file { "/etc/sudoers":
mode => "",
source => "puppet:///modules/admin/sudoers",
backup => ".bak", #增加的
}
同步后。就会在client端原始目录下创建备份文件
3 什么也不配置,会在client端生成备份文件在/var/lib/puppet/clientbucket/
[root@agent1 ~]# ls -l /var/lib/puppet/clientbucket/d///d//c/d//d41d8cd98f00b204e9800998ecf8427e/
total
-r--r-----. root root Jan : contents
-rw-r-----. root root Jan : paths
简单说下:
contens 文件的内容即为原始文件,paths 文件的内容即为原始文件的路径。
对于第三种情况下的恢复
创建检索filebucket
find /var/lib/puppet/clientbucket -name paths -exec cat {} \; -execdir pwd \; -exec date +"%F %T" \; -exec echo \;
会查找出所有的备份文件
/etc/sudoers
/var/lib/puppet/clientbucket/c///d//a/a//
c07d0aa2d43d58ea7b5c5307f532a0b1
-- :: /etc/sudoers
/var/lib/puppet/clientbucket/////e///a/1090e28a70ebaae872c2e
c78894f49eb
-- ::
puppet的常用语法的更多相关文章
- puppet一些常用的参数
puppet一些常用的参数 通过@,realize来定义使用虚拟资源 虚拟资源主要来解决在安装包的时候,互相冲突的问题 具体参考这里 简单说下,在定义资源的时候加上@ 例如: @package { & ...
- Markdown通用的常用语法说明
前言 Markdown 是一种轻量级的 标记语言,语法简洁明了.学习容易,还具有其他很多优点,目前被越来越多的人用来写作使用. Markdown具有一系列衍生版本,用于扩展Markdown的功能(如表 ...
- Markdown简介以及常用语法
Markdown简介以及常用语法 最近发现用markdown记录东西很方便,感觉和emacs的org mode很类似,但是windows下使用emacs不是很方便.特此记录一下markdown常用的语 ...
- Sql常用语法以及名词解释
Sql常用语法以及名词解释 SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE) DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT) D ...
- Markdown常用语法
什么是Markdown Markdown 是一种方便记忆.书写的纯文本标记语言,用户可以使用这些标记符号以最小的输入代价生成极富表现力的文档. 通过Markdown简单的语法,就可以使普通文本内容具有 ...
- 2 hive的使用 + hive的常用语法
本博文的主要内容有: .hive的常用语法 .内部表 .外部表 .内部表,被drop掉,会发生什么? .外部表,被drop掉,会发生什么? .内部表和外部表的,保存的路径在哪? .用于创建一些临时表存 ...
- sql 常用语法汇总
Sql常用语法 SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE) DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT) DCL—数据控 ...
- ES6常用语法
ECMAScript 6(以下简称ES6)是JavaScript语言的下一代标准.因为当前版本的ES6是在2015年发布的,所以又称ECMAScript 2015. 也就是说,ES6就是ES2015. ...
- python MVC、MTV 框架介绍 Django 模板系统常用语法
Django 框架简介一.MVC框架和MTV框架1.MVC 全名Model View Controller,是软件工程中的一种软件架构模式,把软件系统分为三个基本部分.优势: 耦合性低 重用性高 生命 ...
随机推荐
- C#调用迅雷下载,调用迅雷影音播放
方法很多种,这里介绍一种,通过命令行参数调用. try { ]; Process.Start(thunderPath, "http://www.baidu.com/abc.exe" ...
- 深入理解跨域SSO(单点登录)原理与技术
一:SSO体系结构 SSO SSO英文全称Single Sign On,单点登录.SSO是在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统.它包括可以将这次主要的登录映射到其他 ...
- 分布式系统消息中间件——RabbitMQ的使用思考篇
分布式系统消息中间件--RabbitMQ的使用思考篇 前言 前面的两篇文章分布式系统消息中间件--RabbitMQ的使用基础篇与分布式系统消息中间件--RabbitMQ的使用进阶篇,我们简单介 ...
- Jmeter实例(二)简单的性能测试场景
我们在性能测试过程中,首先应该去设计测试场景,模拟真实业务发生的情境,然后针对这些场景去设计测试脚本.为了暴露出性能问题,要尽可能的去模拟被测对象可能存在瓶颈的测试场景. 我在本地部署了一个项目,可以 ...
- vue 二三倍图适配,1像素边框
//文件名为mixin.scss// 2,3倍图适配 @mixin bg-image($url){ background-image: url("~imgs/icon/" + $u ...
- 如何在Github中删除已有仓库或文件
一.删除已有仓库如果我们想要删除Github中没有用的仓库,应该如何去做呢? 进入到我们需要删除的仓库里面,找到“settings”即仓库设置: 然后,在仓库设置里拉到最底部,找到“Danger Zo ...
- mybatis入门 配置文件解释 及测试
这里介绍一下mybatis 根据mybatis的官网说明,mybatis是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置 ...
- 广州商学院16级软工一班&二班-第二次作业成绩
作业地址 https://edu.cnblogs.com/campus/gzcc/GZCC-16SE2/homework/2097 https://edu.cnblogs.com/campus/gzc ...
- CMD管道命令使用
Windows netstat 查看端口.进程占用 开始--运行--cmd 进入命令提示符 输入netstat -ano 即可看到所有连接的PID 之后在任务管理器中找到这个PID所对应的程序如果任务 ...
- Linux之常用软件-服务
在使用Linux系统的时候,经常要使用一些功能,但是并不是系统自带的一些功能,这个时候就需要我们进行扩展安装一些软件. 1)telnet 检测telnet-server的rpm包是否安装 [root ...