ansible hosts文件詳解



# This is the default ansible 'hosts' file.
#
# It should live in /etc/ansible/hosts
#
#   - Comments begin with the '#' character
#   - Blank lines are ignored
#   - Groups of hosts are delimited by [header] elements
#   - You can enter hostnames or ip addresses
#   - A hostname/ip can be a member of multiple groups

# Ex 1: Ungrouped hosts, specify before any group headers.
152.55.249.99  ansible_ssh_pass=test!2013
152.55.249.98  ansible_ssh_pass=test!2013
152.55.249.97  ansible_ssh_pass=test!2013
152.55.249.96  ansible_ssh_pass=test!2013
152.55.249.100  ansible_ssh_pass=test!2013


## green.example.com
## blue.example.com
## 192.168.100.1
## 192.168.100.10

# Ex 2: A collection of hosts belonging to the 'webservers' group

 [test]
152.55.249.[96:100]  ansible_ssh_port=22  ansible_ssh_user=root  ansible_ssh_pass=test!2013  
#152.55.249.97  ansible_ssh_pass=test!2013
#152.55.249.98  ansible_ssh_pass=test!2013
#152.55.249.99  ansible_ssh_pass=test!2013

#ansible_ssh_host   
#用於指定被管理的主機的真實IP

#ansible_ssh_port     
#用於指定連接到被管理主機的ssh端口號,默認是22

#ansible_ssh_user     
#ssh連接時默認使用的用戶名

#ansible_ssh_pass     
#ssh連接時的密碼

#ansible_sudo_pass     
#使用sudo連接用戶時的密碼

#ansible_sudo_exec     
#如果sudo命令不在默認路徑,需要指定sudo命令路徑 ansible_ssh_private_key_file     
#祕鑰文件路徑,祕鑰文件如果不想使用ssh-agent管理時可以使用此選項 ansible_shell_type     
#目標系統的shell的類型,默認sh

#ansible_connection     
#SSH 連接的類型: local , ssh , paramiko,在 ansible 1.2 之前默認是 paramiko ,後來智能選擇,優先使用基於 ControlPersist 的 ssh (支持的前提)

#ansible_python_interpreter     
#用來指定Python解釋器的路徑,默認爲/usr/bin/python 同樣可以指定ruby 、perl 的路徑
#ansible_*_interpreter    
#其他解釋器路徑,用法和ansible_python_interpreter類似,這裏"*"可以是ruby或才perl等其他語言

# If you have multiple hosts following a pattern you can specify
# them like this:

## www[001:006].example.com

# Ex 3: A collection of database servers in the 'dbservers' group

## [dbservers]
##
## db01.intranet.mydomain.net
## db02.intranet.mydomain.net
## 10.25.1.56
## 10.25.1.57

# Here's another example of host ranges, this time there are no
# leading 0s:

## db-[99:101]-node.example.com

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章