当前位置:网站首页>一文解析Ansible配置管理文件
一文解析Ansible配置管理文件
2022-07-20 21:39:00 【InfoQ】
[[email protected] feng]#ansible-config view
[defaults]
inventory = ./xlsx_inventory.py
library = ./library
roles_path = ./roles
module_name = command
gathering = explicit
callback_enabled = timer
string_conversion_action = 'ignore'
allow_world_readable_tmpfiles=True
command_warning = False
Host_key_checking = false
retry_files_enabled = false
deprecation_warnings = False
[[email protected] feng]#ansible all -i xlsx_inventory.py -m ping
[[email protected] feng]#ansible all -m ping
- library = ./library这条配置的作用是定义Ansible自定义模块的存放目录。如果没有这条配置,自定义模块的目录名只能为library,且为当前Ansible项目目录,这是Ansible语法约定的。使用这条配置后,则可以将目录名改成任意名字,存放在任意指定位置。
- roles_path = ./roles这条配置的作用是定义Ansible Roles的存放目录。如果没有这条配置,Ansible Roles的目录名只能为roles,且为当前Ansible项目目录,这是Ansible语法约定的。使用这条配置后,则可以将目录名改成任意名字,存放在任意指定位置。
- module_name = command这条配置的作用是定义使用Ansible命令行工具时默认使用的Ansible模块。使用Ansible命令不加-m选项,则Ansible默认使用这条配置设定的模块,系统默认值为command,大家可以根据自己的使用习惯进行配置。
- gathering = explicit这条配置的作用是定义gather_facts的使用模式。gather_facts有3种使用模式,即implicit、explicit、smart,默认是implicit模式。3种使用模式的作用如下。
- implicit模式:这种模式下gather_facts默认开启,且禁用fact cache。如果想关闭gather_facts,需要在Playbook中显式指定gather_facts = False。
- explicit模式:这种模式下gather_facts默认关闭,且启用fact cache。如果想开启gather_facts,则需要在Playbook中显式指定gather_facts = True。
- smart模式:这种模式下gather_facts默认开启,且启用fact cache。这种模式与implicit模式的不同点在于,前者在Playbook运行过程中,每个主机的fact信息只采集一次。
- callback_enabled = timer这条配置的作用是统计每个play的执行时间。在实际使用Ansible的过程中,如果遇到Playbook执行速度慢,想要查找耗时较多的play,来有针对性地优化Ansible的执行时间时,这条配置会很有帮助。
- string_conversion_action = 'ignore'这条配置的作用是处理Ansible模块传参时的类型转换模式。Ansible Playbooks在模块传参的时候,会默认将非string类型的数据强制转换成string类型,这个功能会在需要传list或dict等类型的参数时出现问题,并且抛出如下警告。使用string_conversion_action参数可以解决这个强制转换并报警的问题。
- allow_world_readable_tmpfiles = True这条配置的作用是将在被管理端生成的临时目录设为全局可读,适用于become_user为非root且未提权的用户场景。
- 4个常用的配置项
边栏推荐
- Starfish OS: create a new paradigm of the meta universe with reality as the link
- Modify the computer registry and add vscode to the right-click menu
- In depth analysis: how chain 2+1 mode plays with investment attraction and drainage
- JZ30 包含min函数的栈
- Bank data management measures
- This domestic API artifact tool is too strong Let me give up postman
- JZ24 反转链表
- JZ67 把字符串转换成整数(atoi)
- In the e-commerce industry with fierce competition, why can the chain 2+1 mode survive for so long?
- 数据库约束&&MySQL进阶查询
猜你喜欢
In the future, a new way of tourism, VR traveling without leaving home, embracing poetry and distance
Facebook will reduce resources related to news products and focus on meta universe and short video content creation
DTOS帝拓思的3D引擎将取代游戏引擎巨兽,实现国产化替代
Dama Chapter 10 (reference data and master data)
C | | structure consortium enumeration type
The new and modified Suzuki Beidou star appeared, safe and comfortable
30 times performance improvement -- implementation of MyTT index library based on dolphin DB
[digital image processing / bilateral filtering experiment] high score course experiment report sharing
Difference between service and systemctl / method of modifying path / a command to view IP address, gateway and DNS server
Dama Chapter 4 (data architecture)
随机推荐
To test / development programmers: programmers who love life, don't work overtime, and are forced
[tensorflow & pytorch] create tensor learning notes
Wang fried power to create wealth fast! Xiangling giant panda 2.0 power products officially launched
i2c adapter驅動
In the standard mode, the SQL node of the production environment can perform routine_ sql_ test_ Tianyi conducts sel
Mohist patrol source code
Dama Chapter 10 (reference data and master data)
30 times performance improvement -- implementation of MyTT index library based on dolphin DB
专注跨境支付一体化服务 iPayLinks荣获《财资》(The Asset)3A亚洲奖!
What if the download of Duoyu security browser is blocked? Turn off the method of download blocking
【STC15控制WS2812 RGB彩灯级联】
JZ31 栈的压入、弹出序列
Training of head and neck segmentation networks with shape prior on small datasets
I2C client driver
2.8 component life cycle
Five reasons why developers use Klocwork for software security
Signal integrity (SI) power integrity (PI) learning notes (XXIX) power distribution network (I)
ROS从入门到精通(十) TF坐标变换原理,为什么需要TF变换?
Is there any risk in opening a mobile stock account? Is it safe?
Change dimension style text fill color