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,是软件工程中的一种软件架构模式,把软件系统分为三个基本部分.优势: 耦合性低 重用性高 生命 ...
随机推荐
- JVM参数配置 java内存区域
java内存区域 一些基本概念 http://www.importnew.com/18694.html https://www.cnblogs.com/wangyayun/p/6557851.html ...
- Contest1692 - 2019寒假集训第三十一场 UPC 11075 Problem D 小P的国际象棋
非常简单的单点修改+区间加+区间查询.我用的是最近刚学的区间修改版本树状数组. 直接维护即可,注意修改后的单点值已经不是a[i],或者b[i],要通过区间查询求单点.不然是错的. 区间修改版本树状数 ...
- Python常用内建方法:__init__,__new__,__class__的理解
python中所有类都是继承自object, 而object提供了很多原始的内建属性和方法,所以用户自定义的类在Python中也会继承这些内建属性.可以使用dir()函数可以查看,虽然python提供 ...
- debian下 Hadoop 1.0.4 集群配置及运行WordCount
说明:我用的是压缩包安装,不是安装包 官网安装说明:http://hadoop.apache.org/docs/r1.1.2/cluster_setup.html,繁冗,看的眼花...大部分人应该都不 ...
- 使用junit测试
package creeper; import java.util.Scanner; public class size { private static int intercePosition = ...
- 【转】Restful是什么
REST的概念是什么 维基百科 表现层状态转换(REST,英文:Representational State Transfer)是Roy Thomas Fielding博士于2000年在他的博士论文 ...
- PAT L2-014 列车调度
https://pintia.cn/problem-sets/994805046380707840/problems/994805063166312448 火车站的列车调度铁轨的结构如下图所示. 两端 ...
- EF内容记录_EF连接Mysql版本问题
EF连接MySQL可用版本,由于EF.MySQLConnection.mysql-for-visualstudio.VS版本.MySQL.Data.MySQL.Data.Entity版本问题较花时间, ...
- python内涵段子爬取练习
# -*- coding:utf-8 -*-from urllib import request as urllib2import re# 利用正则表达式爬取内涵段子url = r'http://ww ...
- Java 异常处理的误区和经验总结
Java 异常处理的误区和经验总结 1 本文着重介绍了 Java 异常选择和使用中的一些误区,希望各位读者能够熟练掌握异常处理的一些注意点和原则,注意总结和归纳.只有处理好了异常,才能提升开发人员 ...