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-主机清单的配置的更多相关文章

  1. Ansible主机清单Inventory文件hosts

    Ansible主机清单Inventory文件hosts 发表于 2017-05-14 | 分类于 运维相关 , Ansible | | 阅读次数 4638 | 字数统计 1,442 | 阅读时长预计 ...

  2. 细说Ansible主机清单inventory

    Ansible是一个系列文章,我会尽量以通俗易懂.诙谐幽默的总结方式给大家呈现这些枯燥的知识点,让学习变的有趣一些. Ansible系列博文直达链接:Ansible入门系列 前言 关于Ansible是 ...

  3. (2)ansible主机清单文件inventory

    1)inventory作用 作用:通常用于定义要管理主机的认证信息,例如ssh登录用户名,密码等相关信息 缺省文件:/etc/ansible/hosts 2)定义主机组方式 #vim /etc/ans ...

  4. ansible 主机清单 /etc/ansible/hosts

    主机清单 [webservers] ansible01 ansible02 ansible03 ansible04 [root@ftp:/root] > ansible webservers - ...

  5. Ansible安装部署和常用命令,及其主机清单inventory(二)

    1.ansible的安装方式 1.1使用yum源安装 yum install ansible -y 1.2使用rpm包安装 https://dl.fedoraproject.org/pub/epel/ ...

  6. Ansible-免密登录与主机清单Inventory

    Ansible的指定用户与密码登录.免密登录.指定ssh端口以及主机清单Inventory配置 在实际使用中并不需要对ansible配置进行修改,或者说只有需要的时候才修改ansible配置. 添加用 ...

  7. 【Ansible 文档】【译文】主机清单文件

    Inventory 主机清单文件 Ansible 可以对你的基础设施中多个主机系统同时进行操作.通过选择在Ansible的inventory列出的一部分主机来实现.inventory默认保存在/etc ...

  8. Ansible 小手册系列 五(inventory 主机清单)

    Ansible 可同时操作属于一个组的多台主机,组和主机之间的关系通过 inventory 文件配置. 默认的文件路径为 /etc/ansible/hosts 主机清单示例 mail.example. ...

  9. [转帖]Ansible批量远程管理Windows主机(部署与配置)

    2018-09-12 12:04:42 https://blog.51cto.com/7424593/2174156 一.测试环境介绍 Ansible管理主机: 系统:   CentOS6.8 IP ...

随机推荐

  1. 百度网盘,实现免费不限速,10M/S?

    前段时间,各大消息都说百度网盘实现了免费和不限速的『提速模式』,可以达到10M/S,于是我带着好奇想要进行测试一下,探一探真假,毕竟只有自己动手实践才知道真理,结果,辜负众望,一向对用户限速还限制上传 ...

  2. 在MyBatis中采用模糊查询变量的引用标志应当是$而不是#

    具体如下例: @Select("select count(*) from hy_stock where name like '%${keyword}%' or code like '%${k ...

  3. pwnable之random

    这题只要多调试几次就会发现其产生的随机数是固定的一个值,那么就可以通过这个随机值和0xdeadbeef反推出我们要输入的数据, 最后附上这题的flag:flag:Mommy, I thought li ...

  4. 怎么把后台传过来的Json拼成table 用Jquery ajax()

    页面上的表格定义:<table id="tableId"></table> js中的代码:var $parent0 = $('#tableId);//获取页 ...

  5. App测试理论简介

    一.App测试常见关注点 1.App的功能测试 功能测试都是我们首要测试的,只有功能实现了才算符合上线发布的最低标准.我们需要检测产品功能是否已实现.产品功能是否符合设计要求.产品功能是否有重复.产品 ...

  6. ctfhub sql注入 整数型注入

    整数型注入 手工注入 1.查看是否存在sql注入,及sql注入类型 2.确定列数 3.确定注入点,以及数据库版本,数据库名称 4.查表名 5.查字段名以及flag值 获得flag值 sqlmap做法 ...

  7. C/C++ 宏操作小技巧

    Abstract 之前写了一个非常mini的log库(也不算库把,自己瞎jb写的),里面几乎都是宏的实现.这里打算趁热打铁,把自己知道的几下子都贴出来,后续如果有新的收获会更新这个博文. 文笔拙劣,主 ...

  8. [LeetCode]Mysql系列5

    题目1 1112. 每位学生的最高成绩 编写一个 SQL 查询,查询每位学生获得的最高成绩和它所对应的科目,若科目成绩并列,取 course_id 最小的一门.查询结果需按 student_id 增序 ...

  9. Azure Cosmos DB介绍及演示

    Azure Cosmos DB 是 Microsoft 提供的全球分布式多模型数据库服务.Cosmos DB是一种NoSql数据库,但是它兼容多种API.它支持SQL, MongoDB.Cassand ...

  10. java虚拟机配置

    -XXSurvivorRatio 设置两个survivor和eden的比,8表示两个survivor:eden:2:8.survivor的比例影响新生代向老年代移动的数度.survivor比例越小,新 ...