1.ansible基本参数介绍

想使用ansible 先--help学习下基本的options吧小兄弟
1:
-m 指定模块名称只有一个模块command 可以省略;-M 指出模块路径来加载
2:
-a 指定模块参数就是模块的内容你知道的很重要很棒
3:
-C,--check 不要做任何修改;相反,试着预测一些可能发生的变化
4:
-D, --diff 在更改(小)文件和模板时,显示这些文件的差异;配合这个参数可以更好的工作,--check
5:
-e EXTRA_VARS, --extra-vars=EXTRA_VARS 设置附加变量为键=值或YAML / JSON,如果文件名以@为前缀
6:
-f FORKS, --forks=FORKS 打开的线程数默认是5,逻辑复杂可以现调节
7:
-i INVENTORY 指出hosts文件
8:
--list-hosts 列出主机列表
[root@salt script]# ansible all --list-hosts
hosts (4):
10.0.0.201
10.0.0.202
10.0.0.203
10.0.0.204
9:
--syntax-check 检查playbook的语法而不执行
10:
-v, --verbose 弹出更多的信息是有助于分析错误,还可以加v最多四个
11:
权限控制
-s, --sudo run operations with sudo (nopasswd) (deprecated(弃用)user
become)
-U SUDO_USER, --sudo-user=SUDO_USER
desired sudo user (default=root) (deprecated, use
become)
-S, --su run operations with su (deprecated, use become)
-R SU_USER, --su-user=SU_USER
run operations with su as this user (default=None)
(deprecated, use become)
-b, --become run operations with become (does not imply password
prompting)
--become-method=BECOME_METHOD
privilege escalation method to use (default=sudo),
valid choices: [ sudo | su | pbrun | pfexec | doas |
dzdo | ksu | runas | pmrun ]
--become-user=BECOME_USER
run operations as this user (default=root)
--ask-sudo-pass ask for sudo password (deprecated, use become)
--ask-su-pass ask for su password (deprecated, use become)
-K, --ask-become-pass
ask for privilege escalation password
举个栗子
--------------------------------------------------------------------------------
further用法

现在的垃圾用法恶心死了

原文地址:https://www.cnblogs.com/leleyao/p/8994648.html