ansible-主机清单的配置
1. ansible主机清单的配置
以下是ansible安装完成后的源文件
1 [root@test-1 ~]# cat /etc/ansible/hosts
2 # This is the default ansible 'hosts' file.
3 #
4 # It should live in /etc/ansible/hosts
5 #
6 # - Comments begin with the '#' character
7 # - Blank lines are ignored
8 # - Groups of hosts are delimited by [header] elements
9 # - You can enter hostnames or ip addresses
10 # - A hostname/ip can be a member of multiple groups
11
12 # Ex 1: Ungrouped hosts, specify before any group headers.
13 [webservers]
14 192.168.200.131 ansible_ssh_user=root ansible_ssh_pass='123456'
15 192.168.200.132
16 192.168.200.133
17 192.168.200.134
18 192.168.200.135
19 192.168.200.136
20
21 ## green.example.com
22 ## blue.example.com
23 ## 192.168.100.1
24 ## 192.168.100.10
25
26 # Ex 2: A collection of hosts belonging to the 'webservers' group
27
28 ## [webservers]
29 ## alpha.example.org
30 ## beta.example.org
31 ## 192.168.1.100
32 ## 192.168.1.110
33
34 # If you have multiple hosts following a pattern you can specify
35 # them like this:
36
37 ## www[001:006].example.com
38
39 # Ex 3: A collection of database servers in the 'dbservers' group
40
41 ## [dbservers]
42 ##
43 ## db01.intranet.mydomain.net
44 ## db02.intranet.mydomain.net
45 ## 10.25.1.56
46 ## 10.25.1.57
47
48 # Here's another example of host ranges, this time there are no
49 # leading 0s:
50
51 ## db-[99:101]-node.example.com
2. ansible定义方式:
1) 直接指明主机地址或主机名
1 test_2.xxxx.cn
2 192.168.200.132
2) 定义一个主机组 [ 组名 ] 把地址或主机名加进去
1 [webservers]
2 192.168.200.131 ansible_ssh_user=root ansible_ssh_pass=123456
3 192.168.200.132
4 192.168.200.133
5 192.168.200.134
6 192.168.200.135
7 192.168.200.136
3) 如果你没有使用公钥,想要使用密码,你也可以这样写(适用于第一次登陆控制)
1 格式: 【主机名】 【指定用户】 【主机地址】 【主机密码】
2 [webservers]
3 192.168.200.131 ansible_ssh_user=root test-1=192.168.200.131 ansible_ssh_pass=123456
ansible-主机清单的配置的更多相关文章
- Ansible主机清单Inventory文件hosts
Ansible主机清单Inventory文件hosts 发表于 2017-05-14 | 分类于 运维相关 , Ansible | | 阅读次数 4638 | 字数统计 1,442 | 阅读时长预计 ...
- 细说Ansible主机清单inventory
Ansible是一个系列文章,我会尽量以通俗易懂.诙谐幽默的总结方式给大家呈现这些枯燥的知识点,让学习变的有趣一些. Ansible系列博文直达链接:Ansible入门系列 前言 关于Ansible是 ...
- (2)ansible主机清单文件inventory
1)inventory作用 作用:通常用于定义要管理主机的认证信息,例如ssh登录用户名,密码等相关信息 缺省文件:/etc/ansible/hosts 2)定义主机组方式 #vim /etc/ans ...
- ansible 主机清单 /etc/ansible/hosts
主机清单 [webservers] ansible01 ansible02 ansible03 ansible04 [root@ftp:/root] > ansible webservers - ...
- Ansible安装部署和常用命令,及其主机清单inventory(二)
1.ansible的安装方式 1.1使用yum源安装 yum install ansible -y 1.2使用rpm包安装 https://dl.fedoraproject.org/pub/epel/ ...
- Ansible-免密登录与主机清单Inventory
Ansible的指定用户与密码登录.免密登录.指定ssh端口以及主机清单Inventory配置 在实际使用中并不需要对ansible配置进行修改,或者说只有需要的时候才修改ansible配置. 添加用 ...
- 【Ansible 文档】【译文】主机清单文件
Inventory 主机清单文件 Ansible 可以对你的基础设施中多个主机系统同时进行操作.通过选择在Ansible的inventory列出的一部分主机来实现.inventory默认保存在/etc ...
- Ansible 小手册系列 五(inventory 主机清单)
Ansible 可同时操作属于一个组的多台主机,组和主机之间的关系通过 inventory 文件配置. 默认的文件路径为 /etc/ansible/hosts 主机清单示例 mail.example. ...
- [转帖]Ansible批量远程管理Windows主机(部署与配置)
2018-09-12 12:04:42 https://blog.51cto.com/7424593/2174156 一.测试环境介绍 Ansible管理主机: 系统: CentOS6.8 IP ...
随机推荐
- Codeforces 1250E The Coronation
解题思路 用2-SAT的思路将题目转化为:已知\(n\)个二元组\(<x,y>\),可以算出有多少属于不同二元组的元素\((a,b)\)存在冲突,要在每个二元组\(<x,y>\ ...
- 不支持原子性的 Redis 事务也叫事务吗?
文章收录在 GitHub JavaKeeper ,N线互联网开发必备技能兵器谱 假设现在有这样一个业务,用户获取的某些数据来自第三方接口信息,为避免频繁请求第三方接口,我们往往会加一层缓存,缓存肯定要 ...
- linux常用命令及配置文件
linux常用命令 基于centos 以我自己实际使用情况来说,从最常用的开始开始,大致如下: 1. 基本命令 cd ls ll(ls -l 别名 ) cat vi/vim touch echo mk ...
- SpringMVC-结果跳转方式
结果跳转方式 目录 结果跳转方式 1. ModelAndView 2. ServletAPI 3. SpringMVC实现 1. 无需视图解析器 2. 使用视图解析器 1. ModelAndView ...
- python应用 曲线拟合 02
前情提要 CsI 闪烁体晶体+PD+前放输出信号满足: $U(t) = \frac{N_f\tau_p}{\tau_p-\tau_f} \left[ e^{-\frac{t}{\tau_p}}-e^{ ...
- 打包下载zip代码
/// <summary> /// 下载文件 /// </summary> /// <param name="dt">需要处理的数据集</ ...
- Euclid's Game(POJ 2348)
原题如下: Euclid's Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10832 Accepted: 4 ...
- Django循环创造div后,对各个div操作后触发事件,传递数据(Django九)
前面我用for循环创建了div,每个div中有各自的数据以及同样的布局 效果图如下:部分代码如下: 现在,我希望在点击每个div里的发表按钮时,能在js里获取{{problem.pro_id}}以及{ ...
- NSOperation类
NSOperation 抽象类 NSOperation 是一个"抽象类",不能直接使用 抽象类的用处是定义子类共有的属性和方法 在苹果的头文件中,有些抽象类和子类的定义是在同一个头 ...
- 第1课 - make和makefile
第1课 - make 和 makefile 1. make make 是一个应用程序,位于 /usr/bin/make 目录下,make 有如下的功能: (1)解析源程序之间的依赖关系 (2)根据依赖 ...