检查语法错误

 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的常用语法的更多相关文章

  1. puppet一些常用的参数

    puppet一些常用的参数 通过@,realize来定义使用虚拟资源 虚拟资源主要来解决在安装包的时候,互相冲突的问题 具体参考这里 简单说下,在定义资源的时候加上@ 例如: @package { & ...

  2. Markdown通用的常用语法说明

    前言 Markdown 是一种轻量级的 标记语言,语法简洁明了.学习容易,还具有其他很多优点,目前被越来越多的人用来写作使用. Markdown具有一系列衍生版本,用于扩展Markdown的功能(如表 ...

  3. Markdown简介以及常用语法

    Markdown简介以及常用语法 最近发现用markdown记录东西很方便,感觉和emacs的org mode很类似,但是windows下使用emacs不是很方便.特此记录一下markdown常用的语 ...

  4. Sql常用语法以及名词解释

    Sql常用语法以及名词解释 SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE) DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT) D ...

  5. Markdown常用语法

    什么是Markdown Markdown 是一种方便记忆.书写的纯文本标记语言,用户可以使用这些标记符号以最小的输入代价生成极富表现力的文档. 通过Markdown简单的语法,就可以使普通文本内容具有 ...

  6. 2 hive的使用 + hive的常用语法

    本博文的主要内容有: .hive的常用语法 .内部表 .外部表 .内部表,被drop掉,会发生什么? .外部表,被drop掉,会发生什么? .内部表和外部表的,保存的路径在哪? .用于创建一些临时表存 ...

  7. sql 常用语法汇总

    Sql常用语法 SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE) DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT) DCL—数据控 ...

  8. ES6常用语法

    ECMAScript 6(以下简称ES6)是JavaScript语言的下一代标准.因为当前版本的ES6是在2015年发布的,所以又称ECMAScript 2015. 也就是说,ES6就是ES2015. ...

  9. python MVC、MTV 框架介绍 Django 模板系统常用语法

    Django 框架简介一.MVC框架和MTV框架1.MVC 全名Model View Controller,是软件工程中的一种软件架构模式,把软件系统分为三个基本部分.优势: 耦合性低 重用性高 生命 ...

随机推荐

  1. Elastic 今日在纽交所上市,股价最高暴涨122%。

    10 月 6 日,Elastic 正式在纽约证券交易所上市,股票代码为"ESTC".开盘之后股价直线拉升,最高点涨幅达122%,截止到收盘涨幅回落到94%,意味着上市第一天估值接近 ...

  2. 网络应用简记(4):DNS使用

    dns,domain name system,域名系统,把域名转化成ip的系统. 先来看几上工具的使用,这几个工具都能把域名转换成ip,都使用了dns.dns就好比数据库,通过对它的查询,能给url找 ...

  3. go项目

    1.循环使用缓存 每条日志需要开辟缓存块来存储内容,以减少频繁的内存分配与回收.日志结构体定义如下: type MLogger struct { // freeList is a list of by ...

  4. Method not found: !!0[] System.Array.Empty()错误

    最近由于公司项目需要将之前支持的TLS1.0改成更安全的TLS1.2,而公司现有项目都是老系统,有的是.NET FrameWork 4.0,有的是.NET FrameWork3.5,但是TLS1.2默 ...

  5. java的instanceof关键字

    java 中的instanceof 运算符是用来判断对象是否是 特定类或这个特定类的子类 的一个实例. 用法: result = object instanceof class 参数: Result: ...

  6. hibernate多对多 一对多 及简单入门 主键生成策略

    Hibernate简单使用 入门 通过hibernate的 一对多 多对多轻松看懂hibernate配置 (不使用注解) hibernate对jdbc访问数据库的代码进行轻量级封装,简化重复代码 减少 ...

  7. HDU - 1166 - 敌兵布阵 线段树的单点修改,区间求和

    #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> ...

  8. 牛客练习赛38 D 出题人的手环

    链接 [https://ac.nowcoder.com/acm/contest/358/D] 题意 链接:https://ac.nowcoder.com/acm/contest/358/D 来源:牛客 ...

  9. VMware威睿

    VMware总部位于美国加州帕洛阿尔托 [1]  ,是全球云基础架构和移动商务解决方案厂商,提供基于VMware的解决方案, 企业通过数据中心改造和公有云整合业务,借助企业安全转型维系客户信任 [2- ...

  10. ORACLE 当字段中有数据如何修改字段类型

    创建视图的时候,因为表太多,里面一些字段类型不一样,PL/SQL报错,为‘表达式必须具有对应表达式相同的数据类型’,发现后,一个字段的类型为CLOB和VARCHAR2(4000)两种,将CLOB进行修 ...