码迷,mamicode.com
首页 > 其他好文 > 详细

ansible hosts文件详解

时间:2017-07-18 11:50:56      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:ansible hosts

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

本文出自 “kan” 博客,请务必保留此出处http://12899802.blog.51cto.com/12889802/1948422

ansible hosts文件详解

标签:ansible hosts

原文地址:http://12899802.blog.51cto.com/12889802/1948422

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!