Ansible 主配置文件详解
Ansible 本身没有服务的概念, 所以只要配置修改后配置将马上生效.
配置选项详解
配置项 | 说明 | 默认值 |
---|---|---|
inventory | ansible inventory 文件路径 | /etc/ansible/hosts |
library | ansible 模块文件路径 | /usr/share/my_modules/ |
remote_tmp | ansible 远程主机脚本临时存放目录 | ~/.ansible/tmp |
local_tmp | ansible 管理节点脚本临时存放目录 | ~/.ansible/tmp |
forks | ansible 执行并发数 | 5 |
poll_interval | ansible 异步任务查询间隔 | 15 |
sudo_user | ansible sudo 用户 | root |
ask_sudo_pass | 运行 ansible 是否提示输入 sudo 密码 | True |
ask_pass | 运行 ansible 是否提示输入密码 | True |
transport | ansible 远程传输模式 | smart |
remote_port | 远程主机 SSH 端口 | 22 |
module_lang | ansible 模块运行默认语言环境 | C |
gathering | facts 信息收集开关定义 | smart |
roles_path | ansible role 存放路径 | /etc/ansible/roles |
timeout | ansible SSH 连接超时时间 | 10 |
remote_user | ansible 远程认证用户 | root |
log_path | ansible 日志记录文件 | /var/log/ansible.log |
module_name | ansible 默认执行模块 | command |
executable | ansible 命令执行 shell | /bin/sh |
hash_behaviour | ansible 主机变量重复处理方式 | replace |
private_role_vars | 默认情况下,角色中的变量将在全局变量范围中可见。 为了防止这种情况,可以启用以下选项,只有 tasks 的任务和 handlers 得任务可以看到角色变量 | yes |
vault_password_file | 指定 vault 密码文件路径 | 无 |
ansible_managed | 定义的一个 Jinja2 变量,可以插入到 Ansible 配置模版系统生成的文件中 | Ansible managed |
display_skipped_hosts | 开启显示跳过的主机 | True |
error_on_undefined_vars | 开启错误,或者没有定义的变量 | False |
action_plugins | ansible action 插件路径 | 无 |
cache_plugins | ansible cache 插件路径 | 无 |
callback_plugins | ansible callback 插件路径 | 无 |
connection_plugins | ansible connection 插件路径 | 无 |
lookup_plugins | ansible lookup 插件路径 | 无 |
inventory_plugins | ansible inventory 插件路径 | 无 |
vars_plugins | ansible vars 插件路径 | 无 |
filter_plugins | ansible filter 插件路径 | 无 |
terminal_plugins | ansible terminal 插件路径 | 无 |
strategy_plugins | ansible strategy 插件路径 | 无 |
fact_caching | 定义 ansible facts 缓存方式 | memory |
fact_caching_connection | 定义 ansible facts 缓存路径 | 无 |
privilege_escalation 配置
配置项 | 说明 | 默认值 |
---|---|---|
become | 是否开启 become 模式 | True |
become_method | 定义 become 方式 | sudo |
become_user | 定义 become 方式 | root |
become_ask_pass | 是否定义 become 提示密码 | False |
host_key_checking = False #检查对应服务器的 host_key(known_hosts), 强烈建议取消注释
来源: http://www.bubuko.com/infodetail-3382724.html