1. 执行顺序
配置文件执行顺序:
* ANSIBLE_CONFIG (环境变量) * ansible.cfg (in the current directory) * .ansible.cfg (in the home directory) * /etc/ansible/ansible.cfg
版本1.5以前的执行顺序:
* ansible.cfg (in the current directory) * ANSIBLE_CONFIG (an environment variable) * .ansible.cfg (in the home directory) * /etc/ansible/ansible.cfg
2.配置文件ansible.cfg中的【default】配置项
Action_Plugins(扩展插件存放目录)
action_plugins = /usr/share/ansible_plugins/action_plugins
Ansible_Managed(插入Ansible模板的字符串)
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
ask_pass(PlayBook是否需要提供密码,默认为No)
#ask_pass=True
ask_sudo_pass(PlayBook是否需要提供sudo 密码)
#ask_sudo_pass=True
callback_plugins(回调函数插件存放路径)
action_plugins = /usr/share/ansible_plugins/action_plugins
connection_plugins(连接插件存放路径)
action_plugins = /usr/share/ansible_plugins/action_plugins
deprecation_warnings(是否展示警告信息)
deprecation_warnings = True
display_skipped_hosts(是否展示跳过的主机的信息)
#display_skipped_hosts=True
error_on_undefined_vars(执行错误时候赋予的变量)
#error_on_undefined_vars=True
executable(默认的Shell)
#executable = /bin/bash
filter_plugins(拦截器插件)
action_plugins = /usr/share/ansible_plugins/action_plugins
forks(最大进程数)
forks=5
hash_behavior(哈希特性,没事不用去动它)
#hash_behavior=replace
hostfile(资产文件存放位置)
hostfile = /etc/ansible/hosts
host_key_checking(是否检查SSH key)
host_key_checking=True
jinja2_extensions(JinJa扩展)
jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n
legacy_playbook_variables(PlayBook变量)
legacy_playbook_variables = no
library(Ansible默认库)
library = /usr/share/ansible
log_path(日志路径)
log_path=/var/log/ansible.log
lookup_plugins(插件路径)
action_plugins = /usr/share/ansible_plugins/action_plugins
module_name(默认模块名称)
module_name = command
nocolor(输出样式)
nocolor=0
nocows(是否使用cowsay打印)
nocows=0
pattern(主机)
hosts=*
poll_interval(pool间隔)
poll_interval=15
private_key_file(私钥的存放路径)
private_key_file=/path/to/file.pem
remote_port(远程连接端口号)
remote_port = 22
remote_tmp(远程目录临时文件夹)
remote_temp = $HOME/.ansible/tmp
remote_user(远程用户)
remote_user = root
roles_path(角色路径)
roles_path = /opt/mysite/roles
sudo_exe(SUDO执行)
sudo_exe=sudo
sudo_flags(SUDO标记)
sudo_flags=-H
sudo_user(sudo用户)
sudo_user=root
timeout(重连次数)
timeout = 10
transport(传输模式)
默认用的smart
vars_plugins(变量插件存放路径)
action_plugins = /usr/share/ansible_plugins/action_plugins
SSH变量
ssh_args(SSH连接参数)
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
scp_if_ssh(采用SCP还是SFTP进行文件传输)
scp_if_ssh=False
转载自:
http://www.kiratechblog.com/?p=420