Ansible主机与组定义
主机与组
/etc/ansible/hosts 文件的格式:
mail.example.com
[webservers]
foo.example.com
bar.example.com
[dbservers]
one.example.com
two.example.com
three.example.com
# 端口号
badwolf.example.com:5309
# 别名
jumper ansible_ssh_port=5555 ansible_ssh_host=192.168.1.50
# 相似主机
[webservers]
www[01:50].example.com
[databases]
db-[a:f].example.com
# 连接类型和用户名
[targets]
localhost ansible_connection=local
other1.example.com ansible_connection=ssh ansible_ssh_user=mpdehaan
other2.example.com ansible_connection=ssh ansible_ssh_user=mdehaan