Puppet 命令参数介绍

前言:

Puppet的工作原理:

puppet master启动默认是监听tcp协议的8140端口.通过ruby的webrick web接收agent端的请求,根据请求内容与master的统一接口文件site.pp文件匹配,将匹配到的主机资源编译成catalog向agent分发,agent接收到请求后在本地应用.

Puppet 命令分为独立命令和集成命令,puppet3.0版本后就没有了独立命令,集成命令也是未来的一个趋势,所以只写puppet集成命令.

通常查看帮助都知道使用-h,查看puppet 命令帮助也一样.

puppet 命令参数:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
[root@puppet puppet]# puppet help
Usage: puppet <subcommand> [options] <action> [options]
Available subcommands:
     
  agent             The puppet agent daemon    #puppet agent守护进程
  apply             Apply Puppet manifests locally    #应用puppet资源清单
  ca                Local Puppet Certificate Authority management.    #管理本地puppet证书
  catalog           Compile, save, view, and convert catalogs.    #编译,保存,查看,转换catalog
  cert              Manage certificates and requests    #管理puppet认证
  certificate       Provide access to the CA for certificate management.    #提供CA证书接入管理
  certificate_request  Manage certificate requests.    #管理证书请求
  certificate_revocation_list  Manage the list of revoked certificates.    #显示删除证书列表
  config            Interact with Puppet's settings.    #puppet 配置选项
  describe          Display help about resource types    #显示资源类型帮助
  device            Manage remote network devices    #管理远程网络设备
  doc               Generate Puppet documentation and references    #puppet 文档生成和引用工具
  facts             Retrieve and store facts.    #存储facts返回信息
  file              Retrieve and store files in a filebucket    #在filebucket中文件个数和存储文件
  filebucket        Store and retrieve files in a filebucket    #文件恢复与还原
  help              Display Puppet help.    #显示puppet 帮助信息
  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     #puppet agent主动更新
  man               Display Puppet manual pages.    #显示puppet 帮助页
  master            The puppet master daemon     #puppet master守护进程
  module            Creates, installs and searches for modules on the Puppet Forge.    #通过puppet forge创建,安装,搜索模块
  node              View and manage node definitions.    #查看和管理节点
  parser            Interact directly with the parser.    #*.pp文件语法检查命令
  plugin            Interact with the Puppet plugin system.    #插件管理
  queue             Deprecated queuing daemon for asynchronous storeconfigs    #puppet队列
  report            Create, display, and submit reports.    #创建,显示,提交报告
  resource          The resource abstraction layer shell    #资源RAL,仅供API使用
  resource_type     View classes, defined resource types, and nodes from all manifests.    #查看类、默认资源与来自manifests的节点信息.
  secret_agent      Mimics puppet agent.    #模拟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 v3.8.7

puppet master 命令参数:(注释部分过多就不贴出来了,挑主要的)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[root@puppet puppet]# puppet master --help
* --daemonize:    #将进程发送到后台运行,是master默认参数
  Send the process into the background. This is the default.
  (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
  prefix for boolean settings on the command line.)
* --no-daemonize:      #将启动进程输出信息发送到标准输出,简单理解不打到后台运行
  Do not send the process into the background.
  (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
  prefix for boolean settings on the command line.)
* --debug:#debug模式
  Enable full debugging.
* --help:    #帮助信息
  Print this help message.
* --logdest:    #指定输出日志的路径和文件名,可以选择系统log和控制终端或者指定路径,默认为控制终端.
  Where to send log messages. Choose between 'syslog' (the POSIX syslog
  service), 'console', or the path to a log file. If debugging or verbosity is
  enabled, this defaults to 'console'. Otherwise, it defaults to 'syslog'.
  A path ending with '.json' will receive structured output in JSON format. The
  log file will not have an ending ']' automatically written to it due to the
  appending nature of logging. It must be appended manually to make the content
  valid JSON.
* --masterport:    #Master自定义端口.
  The port on which to listen for traffic.
  (This is a Puppet setting, and can go in puppet.conf.)
* --verbose:    #输出扩展信息
  Enable verbosity.
* --version:    #显示Master版本信息
  Print the puppet version number and exit.
* --compile:    #编译后的catalog以json的格式输出到 $vardir/yaml/目录,
  Compile a catalogue and output it in JSON from the puppet master. Uses
  facts contained in the $vardir/yaml/ directory to compile the catalog.

Puppet agent参数:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
[root@puppet puppet]# puppet agent --help
#
* --certname:    #指定客户端certname(唯一ID),通常以域名命名
  Set the certname (unique ID) of the client. The master reads this
  unique identifying string, which is usually set to the node's
  fully-qualified domain name, to determine which configurations the
  node will receive. Use this option to debug setup problems or
  implement unusual node identification schemes.
  (This is a Puppet setting, and can go in puppet.conf.)
* --daemonize:    #启动进程发送到后台守护进程,默认选项
  Send the process into the background. This is the default.
  (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
  prefix for boolean settings on the command line.)
* --no-daemonize:    #不发送到后台守护进程
  Do not send the process into the background.
  (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
  prefix for boolean settings on the command line.)
* --debug:    #debug调试模式
  Enable full debugging.
* --detailed-exitcodes:    #提供详细的退出代码
  Provide transaction information via exit codes. If this is enabled, an exit
  code of '2' means there were changes, an exit code of '4' means there were
  failures during the transaction, and an exit code of '6' means there were both
  changes and failures.
* --digest:    #指定证书指纹算法,默认为md5
  Change the certificate fingerprinting digest algorithm. The default is
  SHA256. Valid values depends on the version of OpenSSL installed, but
  will likely contain MD5, MD2, SHA1 and SHA256.
* --disable:    #禁用puppet agent 在此节点执行,agent的守护进程还是运行的,只是此节点不去master同步配置了.
  Disable working on the local system. This puts a lock file in place,
  causing 'puppet agent' not to work on the system until the lock file
  is removed. This is useful if you are testing a configuration and do
  not want the central configuration to override the local state until
  everything is tested and committed.
  Disable can also take an optional message that will be reported by the
  'puppet agent' at the next disabled run.
  'puppet agent' uses the same lock file while it is running, so no more
  than one 'puppet agent' process is working at a time.
  'puppet agent' exits after executing this.
* --enable:    #启用,允许执行puppet agent -t 同步配置.
  Enable working on the local system. This removes any lock file,
  causing 'puppet agent' to start managing the local system again
  (although it will continue to use its normal scheduling, so it might
  not start for another half hour).
  'puppet agent' exits after executing this.
* --fingerprint:    #显示当前证书的指纹
  Display the current certificate or certificate signing request
  fingerprint and then exit. Use the '--digest' option to change the
  digest algorithm used.
* --help:
  Print this help message
* --logdest:    #日志发送方式,默认采用syslog配置
  Where to send log messages. Choose between 'syslog' (the POSIX syslog
  service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
  file. If debugging or verbosity is enabled, this defaults to 'console'.
  Otherwise, it defaults to 'syslog' on POSIX systems and 'eventlog' on Windows.
  A path ending with '.json' will receive structured output in JSON format. The
  log file will not have an ending ']' automatically written to it due to the
  appending nature of logging. It must be appended manually to make the content
  valid JSON.
* --masterport:    #指令puppet端口的
  The port on which to contact the puppet master.
  (This is a Puppet setting, and can go in puppet.conf.)
* --no-client:    #不要创建客户端配置文件,当listen=true 时才有意义
  Do not create a config client. This will cause the daemon to start
  but not check configuration unless it is triggered with `puppet
  kick`. This only makes sense when puppet agent is being run with
  listen = true in puppet.conf or was started with the `--listen` option.
* --noop:    #使用'noop'模式,仅运行测试,catalog不在agent端应用.
  Use 'noop' mode where the daemon runs in a no-op or dry-run mode. This
  is useful for seeing what changes Puppet will make without actually
  executing the changes.
  (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
  prefix for boolean settings on the command line.)
* --onetime:    #运行一次,配合--no-daemonize使用
  Run the configuration once. Runs a single (normally daemonized) Puppet
  run. Useful for interactively running puppet agent when used in
  conjunction with the --no-daemonize option.
  (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
  prefix for boolean settings on the command line.)
* --test:    #测试,但是会在本地应用catalog
  Enable the most common options used for testing. These are 'onetime',
  'verbose''ignorecache''no-daemonize''no-usecacheonfailure',
  'detailed-exitcodes''no-splay', and 'show_diff'.
* --verbose:    #显示puppet扩展信息
  Turn on verbose reporting.
* --version:    #显示puppet版本信息
  Print the puppet version number and exit.
* --waitforcert:    #agent向master证书认证等待时间,默认为agent2分钟向master请求一次,如果设为0,表示不等待.
  This option only matters for daemons that do not yet have certificates
  and it is enabled by default, with a value of 120 (seconds). This
  causes 'puppet agent' to connect to the server every 2 minutes and ask
  it to sign a certificate request. This is useful for the initial setup
  of a puppet client. You can turn off waiting for certificates by
  specifying a time of 0.
  (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
  prefix for boolean settings on the command line.)

Agent端尝试运行玩玩,没有资源也可以运行:

1
2
3
4
5
6
[root@sh-proxy2 ~]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for sh-proxy2.localdomain
Info: Applying configuration version '1504617222'
Notice: Finished catalog run in 0.02 seconds

注释:如果有资源可以看到整个资源的更改,和是否运行成功.目前只能看到访问Master的耗时.

注意:Agent的运行方式有两种:1)命令直接连接master做更新.2)守护进程运行,每30分钟检测更新(这个时间自己可以设置).公司的生产直接将puppet agent -t 加到crontab计划任务做更新(参考借鉴).

举例:

1
2
[root@sh-proxy2 ~]# crontab -l
28,58 * * * * /usr/bin/puppet agent -t &>/dev/null

举例:agent服务并没donw,但是agent端也不能从master更新资源.使用--enable开启,再使用puppet agent -t继续更新资源.

1
2
3
4
5
6
[root@sh-proxy2 ~]# puppet agent --disable
[root@sh-proxy2 ~]# /etc/init.d/puppet status
puppet (pid  37949) is running...
[root@sh-proxy2 ~]# puppet agent -t
Notice: Skipping run of Puppet configuration client; administratively disabled (Reason: 'reason not specified');
Use 'puppet agent --enable' to re-enable.

本文转自青衫解衣 51CTO博客,原文链接:http://blog.51cto.com/215687833/1963179

Puppet 命令参数介绍(三)相关推荐

  1. HDFS的简介及基本操作(常用的命令参数介绍)

    目录 前言: 1.HDFS基本概念 2.HDFS基本操作 总结: 目录 前言: 总算有空来接着写大数据的学习笔记了,今天就把之前学过的HDFS的基础知识详细的介绍一下,如有哪点写的不足希望大家多多指教 ...

  2. HDFS命令行客户端使用,命令行客户端支持的命令参数,常用命令参数介绍

    3.HDFS的shell(命令行客户端)操作 3.1 HDFS命令行客户端使用 HDFS提供shell命令行客户端,使用方法如下: [toto@hadoop hadoop-2.8.0]$ hdfs d ...

  3. ansible命令参数介绍

    ansible命令参数介绍 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -m:要执行的模块,默认为command -a:模块的参数 -u:ssh连接 ...

  4. 第五章 Mininet常用命令参数介绍

    mn 观察,可以知道,已经进入了这个自带的网络,网络中有1个交换机和2个主机,且在打开这个网络之后,进入了  mininet>  这个命令模式 然后输入相关命令查看网络状态,如下图所示: 查看可 ...

  5. linux编程参数列表,Linux编程 14 文件权限(用户列表passwd,用户控制shadow,useradd模板与useradd命令参数介绍)...

    一. 概述 linux安全系统的核心是用户账户. 创建用户时会分配用户ID(UID). UID是唯一的,但在登录系统时不是用UID,而是用登录名.在讲文件权限之之前,先了解下linux是怎样处理用户账 ...

  6. Ubuntu18.04系统下,gcc编译过程分析、命令参数介绍及ELF文件格式学习

    GCC编译器背后的故事及常用命令.了解ELF文件格式 文章目录 GCC编译器背后的故事及常用命令.了解ELF文件格式 前言 一.GCC简介 二.GCC背后的战友 1.Binutils 2.C运行库 三 ...

  7. Mysqldump命令参数介绍

    mysqldump命令参数 mysql  mysqldump客户端可用来转储数据库或搜集数据库进行备份或将数据转移到另一个SQL服务器(不一定是一个MySQL服务器).转储包含创建表和/或装载表的SQ ...

  8. Hadoop常用命令参数介绍

    常用命令 - help 功能:输出这个命令参数手册 - ls 功能:显示目录信息 示例:hadoop fs -ls hdfs://hadoop-hello/ 备注:这些参数中,所有的hdfs路径都可以 ...

  9. Ping命令 参数介绍!

    Ping命令详解 对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这 ...

最新文章

  1. bool 变量想为什么一般初始化为FALSE 比较好?
  2. vue 点击弹出文字_vue事件点击穿透解决大法,看这篇文章就够了
  3. 微课堂迎圣诞送福利 | 姬十三@你:我想和你相聚社区共度圣诞良宵,约么?
  4. OpenCV源码安装教程(兼容CUDA)
  5. Python3实现队列
  6. Flexible 弹性盒子模型之CSS flex-shrink 属性
  7. 论文浅尝 - ACL2020 | 用于多媒体事件提取的跨媒体结构化公共空间
  8. 二叉排序树转双向链表
  9. ios keychain 不被清理_iOS签名机制和说明文件【ios企业签名吧】
  10. mysql root拿shell_mysql的几种获取shell和提权的方式
  11. ES6 Symbol之浅入解读
  12. Message Queue基本使用说明
  13. 在网上看到SpiceWorks是一个免费但很强大的HELPDESK系统
  14. 解决post提交时参数的中文乱码问题
  15. NAT技术与代理服务器调研
  16. 【无机纳米材料科研制图——Visio 0305】开启开发人员模式绘制表面等离子共振SPR机理图
  17. 前端学习之路-聚美优品注册页面的实现
  18. RabbitMQ高可用集群搭建
  19. Ubuntu下的opencv:在图片上加汉字和数字
  20. Mavenir融合分组核心解决方案将为德国电信在德国的5G独立组网(SA)网络提供支持

热门文章

  1. Dubbo消费者代理的调用
  2. spark任务shell运行_Spark原理与实战之部署模式与运行机制
  3. oracle 建分区索引_ORACLE 创建组合分区索引
  4. sql server远程主机强迫关闭了一个_交换机远程端口镜像
  5. 单例设计模式 序列化破坏单例模式原理解析及解决方案?
  6. 自适应网站设计对百度友好的关键:添加applicable-device标签(转)
  7. Whoops, looks like something went wrong.
  8. Assemby 打包并启动jar包
  9. redis中list类型详解及常用命令
  10. MySQL为什么用 B+ 树,不用 B 树?