设为首页 加入收藏

TOP

Ansible(二) - 配置及命令简介(一)
2017-10-13 10:37:14 】 浏览:3973
Tags:Ansible 配置 命令 简介

Ⅰ. Ansible Inventory Hosts文件配置

# mkdir /etc/ansible # touch /etc/ansible/hosts # cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.137.6 client 192.168.137.5 server 192.168.137.7 web1 192.168.137.8 web2
#
cat /etc/ansible/
hosts [local] server client
[web] web[1:2]
192.168.13.14:52022
jumpter ansible_port=5555 ansible_host=192.168.1.50 ansible_user=xxx ansible_ssh_pass="xxxx"

 

我这里就添加了两个主机组:local、web,local主机组两台主机,web主机组4台主机。

这里你可以把同一类主机或者是想统一管理的主机放在一个主机组里。

 

 # 其他ansible2.3  inventory参数举例

General for all connections:

 
  
ansible_host
The name of the host to connect to, if different from the alias you wish to give to it.
ansible_port
The ssh port number, if not 22
ansible_user
The default ssh user name to use.
 
  

Specific to the SSH connection:

 
  
ansible_ssh_pass
The ssh password to use (never store this variable in plain text; always use a vault. See  Variables and Vaults)
ansible_ssh_private_key_file
Private key file used by ssh. Useful if using multiple keys and you don’t want to use SSH agent.
ansible_ssh_common_args
This setting is always appended to the default command line for  sftpscp, and  ssh. Useful to configure a  ProxyCommand for a certain host (or group).
ansible_sftp_extra_args
This setting is always appended to the default  sftp command line.
ansible_scp_extra_args
This setting is always appended to the default  scp command line.
ansible_ssh_extra_args
This setting is always appended to the default  ssh command line.
ansible_ssh_pipelining
Determines whether or not to use SSH pipelining. This can override the  pipelining setting in  ansible.cfg.
ansible_ssh_executable (added in version 2.2)
This setting overrides the default behavior to use the system  ssh. This can override the  ssh_executable setting in  ansible.cfg.
 
  

Privilege escalation (see Ansible Privilege Escalation for further details):

 
  
ansible_become
Equivalent to  ansible_sudo or  ansible_su, allows to force privilege escalation
ansible_become_method
Allows to set privilege escalation method
ansible_become_user
Equivalent to  ansible_sudo_user or  ansible_su_user, allows to set the user you become through privilege escalation
ansible_become_pass
Equivalent to  ansible_sudo_pass or  ansible_su_pass, allows you to set the privilege escalation password (never store this variable in plain text; always use a vault. See  Variables and Vaults)
ansible_become_exe
Equivalent to  ansible_sudo_exe or  ansible_su_exe, allows you to set the executable for the escalation method selected
ansible_become_flags
Equivalent to  ansible_sudo_flags or  ansible_su_flags, allows you to set the flags passed to the selected escalation method. This can be also set globally in  ansible.cfg in the  sudo_flags option
 
  

Remote host environment parameters:

 
  
ansible_shell_type
The shell type of the target system. You should not use this setting unless you have set the
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇OpenLDAP配置TLS加密传输 下一篇Ansible(一) - 入门及安装

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目