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 ...
随机推荐
- Java8 Strean api
Stream 遍历数据集的高级迭代器.使用StreamApi让代码: 声明式:更简洁,更易读: 可复合:更灵活: 可并行:性能更好: 使用流 流的使用一般包括三件事: 一个数据源(如集合)来执行一个查 ...
- postgres 无法删除表
起因 在postgress下删除表的时候报错 解决 简单的百度了一下,有些人说是用户权限的问题,需要切换到库的拥有者下删除,但是切换后还是没有解决··· 最后换了一种方式搜索,不直接搜索报错命令,直接 ...
- ui自动化--鼠标操作ActionChains
需要先引入鼠标操作模块:from selenium.webdriver.common.action_chains import ActionChains 实际上ActionChains这个模块的实现的 ...
- dict字典,以及字典的一些基本应用
dict表示方法: dict={}或d=dict() 1.字典的增:d['元素名']='元素值'.或d.setdefault('key','value') 2.字典的删:d.pop(key).或del ...
- Hadoop之MapReduce开发总结
@ 目录 1.输入数据接口:InputFormat 2.逻辑处理接口:Mapper 3.Partitioner分区 4.Comparable排序 5.Combiner合并(可选) 6.Reduce端分 ...
- Kafka 【入门一篇文章就够了】
初识 Kafka 什么是 kafka Kafka 是由 Linkedin 公司开发的,它是一个分布式的,支持多分区.多副本,基于 Zookeeper 的分布式消息流平台,它同时也是一款开源的基于发布订 ...
- P4742 【[Wind Festival]Running In The Sky】
相信来做这道题的人肯定都学过\(Tarjan\)缩点吧,如果没有建议先去做P3387 [模板]缩点,如果你忘了,建议也去看看 满足上面要求后,你会惊奇发现,这两道题基本一样,唯一的差别就是这道题需要记 ...
- Go 里的函数
1. 关于函数 函数是基于功能或 逻辑进行封装的可复用的代码结构.将一段功能复杂.很长的一段代码封装成多个代码片段(即函数),有助于提高代码可读性和可维护性. 在 Go 语言中,函数可以分为两种: 带 ...
- Aop的学习与使用
什么是aop AOP(Aspect Oriented Programming)意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术.AOP是OOP的延续,是软件开发中的一 ...
- SQL Server通过创建临时表遍历更新数据
前言: 前段时间新项目上线为了赶进度很多模块的功能都没有经过详细的测试导致了生成环境中的数据和实际数据对不上,因此需要自己手写一个数据库脚本来更新下之前的数据.(线上数据库用是SQL Server20 ...