Ansible学习 Inventory文件
Ansible可同时操作属于一个组的多台主机,组与主机之间关系配置在inventory文件中,inventory默认的配置文件是/etc/ansible/hosts
1、在/etc/ansible/hosts文件中配置两个组,分别为test1和test2
[test1]
192.168.144.129
[test2]
192.168.144.130
1.1、对一个组操作
[root@client01 ansible]# ansible test1 -m ping
192.168.144.129 | SUCCESS => {
"changed": false,
"failed": false,
"ping": "pong"
}
1.2、对两个组同时操作
[root@client01 ansible]# ansible test1:test2 -m ping
192.168.144.130 | SUCCESS => {
"changed": false,
"failed": false,
"ping": "pong"
}
192.168.144.129 | SUCCESS => {
"changed": false,
"failed": false,
"ping": "pong"
}
除了默认使用/etc/ansible/hosts,还可用通过-i选项指定inventory文件
[root@client01 ansible]# ansible all -i /home/zhuwan/ansible/hosts -m ping
192.168.144.129 | SUCCESS => {
"changed": false,
"failed": false,
"ping": "pong"
}
Ansible学习 Inventory文件的更多相关文章
- 002.Ansible之Inventory文件
一 简介 在使用Ansible来批量管理主机的时候,通常我们需要先定义要管理哪些主机或者主机组,而这个用于管理主机与主机组的文件就叫做Inventory,也叫主机清单.该文件默认位于/etc/ansi ...
- ansible的inventory文件含义
默认文件为/etc/ansible/hosts 例如 [test] web.yinzhipeng.com dhcp ansible_ssh_host=172.16.18.195 1.中括号中的名字代表 ...
- Ansible主机清单Inventory文件hosts
Ansible主机清单Inventory文件hosts 发表于 2017-05-14 | 分类于 运维相关 , Ansible | | 阅读次数 4638 | 字数统计 1,442 | 阅读时长预计 ...
- Ansible 之动态Inventory文件(二)
上篇主要讲解了Ansible 的安装和配置,并且根据不同的业务场景将服务器的信息存放在Ansible的Inventory中,其实存放这样的数据每次更新都需要我们自动的添加和删除,这样对于我们维护起来很 ...
- 自动化运维工具ansible学习+使用ansible批量推送公钥到远程主机
目录: 一.ansible简介 1.1.ansible是什么 1.2.ansible如何工作 1.3.ansible优缺点 1.4.ansible安装方式 1.5.ansible文件简单介绍 1.6. ...
- ansible 学习与实践
title: ansible 学习与实践 date: 2016-05-06 16:17:28 tags: --- ansible 学习与实践 一 介绍 ansible是新出现的运维工具是基于Pytho ...
- Ansible之 Inventory 资源清单介绍
一.Inventory 库存清单文件 1.Inventory 作用 Ansible 可以在同一时间针对多个系统设施进行管理工作.它通过选择Ansible 资源清单文件中列出的系统,该清单文件默认是在/ ...
- Ansible学习实战手记-你想要知道的可能都在这里了
最近接触了ansible工具,查找了一些资料,也做了一些总结.希望能给刚接触的新手带来一些帮助. 此总结有实际例子,大部分也是从实践中用到才逐一总结的. 当然可能肯定一定会存在一些错误和纰漏,还望大家 ...
- Ansible学习记录一:Linux下部署
0.Ansible介绍 Ansible 是一个简单的自动化运维管理工具,可以用来自动化部署应用.配置.编排 task(持续交付.无宕机更新等),采用 paramiko 协议库(fabric 也使用这个 ...
随机推荐
- Java文件与io——打印流和对象流
打印流的主要功能是用于输出,在整个IO包中打印流分为两种类型: 字节打印流:PrintStream 字符打印流:PrintWriter 打印流可以很方便的进行输出 public class Print ...
- (转)Bash Shell常用快捷键
Bash Shell常用快捷键 原文:https://github.com/hokein/Wiki/wiki/Bash-Shell%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B ...
- abp(net core)+easyui+efcore仓储系统——解决方案介绍(二)
abp(net core)+easyui+efcore仓储系统目录 abp(net core)+easyui+efcore仓储系统——ABP总体介绍(一) ABP框架 首先介绍一下abp框架,abp其 ...
- Mercurial(HG) Windows+Eclipse安装、配置、使用
Mercurial(HG) Windows客户端安装 Mercurial(HG): http://mercurial.selenic.com/ Windows客户端下载:http://mercuria ...
- Chapter 18 MySQL NDB Cluster 7.3 and NDB Cluster 7.4渣翻
Table of Contents 18.1 NDB Cluster Overview 18.2 NDB Cluster Installation 18.3 Configurati ...
- &&运算符和||运算符的优先级问题 专题
public class SyntaxTest { @Test public void test() { System.out.println(true || true && fals ...
- 使用AOP监控用户操作并插入数据库
引入依赖 <!--spring切面aop依赖--> <dependency> <groupId>org.springframework.boot</group ...
- h5新增属性本地存储
---恢复内容开始--- 存储的两种类型: localStorage 和 sessionStorage localstorage:没有时间限制的数据存储 sessionStorage 针对一个ses ...
- C#中 String和string的区别
string 是 System.String的别名,所以相当于声明了 using string = System.String 再者,string是C#的关键字,String是System下的类名.
- Selenium常见元素定位方法和操作的学习介绍
参考地址: https://www.cnblogs.com/eastmount/p/4810690.html 这篇文章主要Selenium+Python自动测试或爬虫中的常见定位方法.鼠标操作.键盘操 ...