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 ...
随机推荐
- 深入了解Netty【八】TCP拆包、粘包和解决方案
1.TCP协议传输过程 TCP协议是面向流的协议,是流式的,没有业务上的分段,只会根据当前套接字缓冲区的情况进行拆包或者粘包: 发送端的字节流都会先传入缓冲区,再通过网络传入到接收端的缓冲区中,最终由 ...
- 软件架构与设计 百度网盘的pdf电子书籍
如有版权问题请及时联系小编 软件架构与设计 百度网盘的pdf电子书籍 1:<软件体系结构(PDF)>https://pan.baidu.com/s/1lChfIJt5lc63KO09n5L ...
- Agumaster 改善了pagination
页面越来越完善了.
- 使用dbUnit的 IDataSet 因乱序造成assert失败而采取的措施
本例源码下载:https://files.cnblogs.com/files/xiandedanteng/dbUnitTest20200211.zip 在做IDataSet比较时,特殊情况下会有期盼的 ...
- 莫名其妙的Explain Plan
两张表的建表语句: CREATE TABLE hy_emp ( empno NUMBER(8,0) not null primary key, ename NVARCHAR2(60) not null ...
- pwnable.kr之fd
题目如图: 在终端输入:ssh fd@pwnable.kr -p2222 连接到远程终端,如图: 输入ls -l,查看文件: 输入whoami,查看自身用户名称: 根据题目意思我们只要打开flag文件 ...
- CTF资源
WINDOWS 逆向工程师技能表 https://www.sec-wiki.com/skill/6 Software-Security-Learning https://chybeta.github. ...
- 数据库漏洞扫描工具scuba
1.先下载安装scuba 参考地址 https://www.52pojie.cn/thread-702605-1-1.html 百度网盘下载地址: 链接:https://pan.baidu.com/ ...
- JVM学习(三)JVM垃圾回收
一.引用的分类 在了解JVM垃圾回收机制之前,了解一下对象的引用类型是非常必要的. 强引用:GC时不会被回收 软引用:描述有用但不是必须的对象,在发生内存溢出异常之前被回收 弱引用:描述有用但不是必须 ...
- spring cloud微服务快速教程之(十四)spring cloud feign使用okhttp3--以及feign调用参数丢失的说明
0-前言 spring cloud feign 默认使用httpclient,需要okhttp3的可以进行切换 当然,其实两者性能目前差别不大,差别较大的是很早之前的版本,所以,喜欢哪个自己选择: 1 ...