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 ...
随机推荐
- List集合对象去重及按属性去重的8种方法-java基础总结系列第六篇
最近在写一些关于java基础的文章,但是我又不想按照教科书的方式去写知识点的文章,因为意义不大.基础知识太多了,如何将这些知识归纳总结,总结出优缺点或者是使用场景才是对知识的升华.所以我更想把java ...
- 关于Vue的那些事儿
Vue 渐进式框架 众前端周知,Vue是一套用于构建用户界面的渐进式框架,自底向上逐层应用,关注视图层.那我们就来说道说道: 渐进式:声明式渲染->组件系统->客户端路由(router)- ...
- Promise核心实现
核心 构造函数核心 维护状态变量,只能由pending变为resolve或者reject 维护一个存储结果的变量 维护一个回调数组,执行到then,如果我们传入的立即执行函数没有立即执行resolve ...
- 关于Java代理那些事儿
代理是啥?就是代替你执行你持有的主要功能,并且能在你的基础之上完成一些其他的功能.代理的目的就是生成一个和原对象具有同样功能的对象.在Java中,代理是一种设计模式.在Spring的面向切面编程(AO ...
- Mybatis如何执行Select语句,你真的知道吗?
持续原创输出,点击上方蓝字关注我吧 作者:不才陈某 博客:https://chenjiabing666.github.io 前言 本篇文章是Myabtis源码分析的第三篇,前两篇分别介绍了Mybati ...
- pytest测试框架 -- assert断言和fixture固件
一.断言 (1)使用assert语句进行断言 # test_run.py @pytest.mark.assert def test_assert(self): r = requests.get(&qu ...
- python操作从数据库中获取数据的接口
1.输入一个表名,获取表里面的数据 2.判断用户是否存在,如果不存在就添加到数据库里面
- xmake v2.3.7 发布, 新增 tinyc 和 emscripten 工具链支持
xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua 维护项目构建,相比 makefile/CMakeLists.txt,配置语法更加简洁直观,对新手非常友好,短时间内就能 ...
- [LeetCode] 22. 括号生成(回溯/DP)
题目 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合. 例如,给出 n = 3,生成结果为: [ "((()))", "(()( ...
- python-面向过程面向对象和栈的实现
0x01 大纲 面向过程 函数 参数传递 返回 面向对象 类 栈的数据结构实现 0x02 例子 def add(a,b): return a+b if __name__ == '__main__': ...