ansible使用2-inventory & dynamic inventory
默认位置
/etc/ansible/hosts
标准
mail.example.com
[webservers]
foo.example.com
bar.example.com
[dbservers]
one.example.com
two.example.com
three.example.com
# 2个主机组webservers&dbservers,一个孤儿主机mail.example.com
非默认ssh端口
badwolf.example.com:5309
主机别名&ssh通道
jumper ansible_ssh_port=5555 ansible_ssh_host=192.168.1.50
# jumper是主机别名,连接192.168.1.50:5555端口
配置大量主机
[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
主机变量
[atlanta]
host1 http_port=80 maxRequestsPerChild=808
host2 http_port=303 maxRequestsPerChild=909
# 变量http_port,maxRequestsPerChild用于playbook
主机组变量
[atlanta]
host1
host2
[atlanta:vars]
ntp_server=ntp.atlanta.example.com
proxy=proxy.atlanta.example.com
# 关键字:var,变量ntp_server,proxy
主机组嵌套
[atlanta]
host1
host2
[raleigh]
host2
host3
[southeast:children]
atlanta
raleigh
[southeast:vars]
some_server=foo.southeast.example.com
halon_system_timeout=30
self_destruct_countdown=60
escape_pods=2
[usa:children]
southeast
northeast
southwest
northwest
# 关键字:children
在文件存储主机及主机组变量
/etc/ansible/group_vars/raleigh
/etc/ansible/group_vars/webservers
/etc/ansible/host_vars/foosball
# 主机foosball,主机组raleigh & webservers
dynamic inventory
/etc/ansible/hosts是基于文本管理的数据,可以将inventory存储在数据库,使用http api进行交互。编写脚本将inventory数据json化。
http://docs.ansible.com/developing_inventory.html
ansible使用2-inventory & dynamic inventory的更多相关文章
- Ansible: hosts文件拆分为inventory和定义inventory全局变量
前言 随着管理机器的增多,我们在使用Ansible的时候时常会遇到hosts文件过于冗长的问题,极其不便于管理,而将hosts文件拆分为inventory就可解决该问题:另外,hosts中的每个主机条 ...
- Amazon.com Seller Distributed Inventory Placement Inventory Placement Service
Greetings, Thank you for writing to us. I understand that you would like to send inventory to our wa ...
- Documentation | AnsibleWorks
Documentation | AnsibleWorks Welcome to the Ansible documentation! Ansible is an IT automation too ...
- 【Ansible 文档】【译文】动态inventory
Dynamic Inventory 动态inventory 配置管理系统的用户经常想要保存inventory到不同的软件系统中.Ansible提供了一个基本的基于文本的系统,正如inventory中描 ...
- Ansible 小手册系列 五(inventory 主机清单)
Ansible 可同时操作属于一个组的多台主机,组和主机之间的关系通过 inventory 文件配置. 默认的文件路径为 /etc/ansible/hosts 主机清单示例 mail.example. ...
- ansible 的组件inventory
P44 Ansible 的默认的inventory的是一个静态的ini格式的文件/etc/ansible/hosts. 我们还可以通过ansible_hosts环境变脸指定或者运行ansible和an ...
- Ansible 之动态Inventory文件(二)
上篇主要讲解了Ansible 的安装和配置,并且根据不同的业务场景将服务器的信息存放在Ansible的Inventory中,其实存放这样的数据每次更新都需要我们自动的添加和删除,这样对于我们维护起来很 ...
- inventory file 与hosts patterns (ansible 机器清单 与 主机匹配模式)
Ansible配置: ansible有两个核心配置文件: ansible.cfg 配置文件和Inventory配置文件 Ansible.cfg配置文件 Inventory机器列表配置 这里介绍Inve ...
- Ansible的Inventory管理
Ansible将可管理的服务器集合成为Inventory,Inventory的管理便是服务器的管理. hosts文件的位置: /etc/ansible/hosts 在命令行通过-i参数指定 通过/et ...
随机推荐
- vue.js路由学习笔记
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- maven 项目 配置docker镜像生成(dockerfile-maven-plugin)
插件地址:https://github.com/spotify/dockerfile-maven 依github上备注,只要在项目根上录上编写dockerfile,然后引用插件即可 编写Dockerf ...
- Oracle11g 脚本创建表空间和用户
/*分为四步 *//*第1步:创建临时表空间 */create temporary tablespace emaoyi_temp tempfile 'D:\app\Administrator\prod ...
- Visible Ops
Link:http://www.wikisummaries.org/Visible_Ops Contents [hide] 1 What is ITIL? 2 Introduction 3 Phas ...
- spoj COT - Count on a tree(主席树 +lca,树上第K大)
您将获得一个包含N个节点的树.树节点的编号从1到Ñ.每个节点都有一个整数权重. 我们会要求您执行以下操作: uvk:询问从节点u到节点v的路径上的第k个最小权重 输入 在第一行中有两个整数Ñ和中号.( ...
- ajax加载菊花loading效果
Ajax异步请求的时候,一般都会利用一个动态的gif小图片来制作一个Ajax Loading,以便增加用户体验. 这里我们可以使用Spin.js,该js脚本压缩后5k,可以不用任何图片,任何外部CSS ...
- my.宠物升级79级
1.蚌仙子 74级半不到的时候,吃 月华露(500000经验的那种) 吃3个 正好 79级半 我记得 之前 是升满75级 再吃月华露 到79级的时候 经验溢出了.不突破还好,突破的话 宠物就升级了 ...
- silverlight vs2010 需要缺少的web组件才能加载
在打开一个开源的Silverlight项目是遇到如图所示的问题,点击是后没有反应. 查了资料,需要安装微软的webpi(Microsoft Web Platform Installer) webpi的 ...
- Deep Learning 和 Knowledge Graph howto
领军大家: Geoffrey E. Hinton http://www.cs.toronto.edu/~hinton/ 阅读列表: reading lists and survey papers fo ...
- 搜索提示(search suggest)文献阅读
Learning to Personalize Query Auto-Completion 样本 正例用用户的sug点击,其余是负例 特征 用户历史特征: query历史频次,候选和用户历史输入的ng ...