ansible使用文档
假设A机器上安装ansible
yum install ansible
vim /etc/ansible/hosts
对每个主机加key认证
ssh-copy-id -i ~/.ssh/id_rsa.pub root@B_ip
ansible all -m ping
一个playbook文件可以引入其他的yml文件,实现复用。- include: path/other.yml
roles
使用roles可以更好的组织框架,简单例子:
当前目录结构:
.
├── hosts
├── roles
│ └── common
│ └── tasks
│ └── main.yml
└── site.yml
site.yml文件是入口,内容为
---
- hosts: all
roles:
- role: common
- hosts: v1
tasks:
- include: roles/common/tasks/main.yml
commom角色是用于在全部主机上执行的任务,任务为ping,tasks中文件名必须为main,其内容为
---
- name: test connection
ping:
v1角色是通过include直接指定task。运行:
ansible-playbook site.yml -vv
应该就能看到返回结果。
ansible使用文档的更多相关文章
- ansible安装文档
一.系统环境 [root@ansible ~]# cat /etc/redhat-release CentOS release 6.6 (Final) [root@ansible ~]# uname ...
- ansible --help 文档
> ansible --help Usage: ansible <host-pattern> [options] Define and run a single task 'play ...
- 【Ansible 文档】【译文】Playbooks 变量
Variables 变量 自动化的存在使得重复的做事情变得很容易,但是我们的系统不可能完全一样. 在某些系统中,你可能想要设置一些与其他系统不一样的行为和配置. 同样地,远程系统的行为和状态也可以影响 ...
- 【Ansible 文档】【译文】网络支持
Networking Support 网络支持 Working with Networking Devices 使用网络设备 自从Ansible 2.1开始,你现在可以使用成熟模型 - 编写 play ...
- 【Ansible 文档】【译文】Windows 支持
see also:List of Windows Modules Windows Support Windows 支持 Windows: How Does It Work Windows:如何工作 正 ...
- 【Ansible 文档】【译文】配置文件
这里说明一下配置文件的内容,原文地址:http://docs.ansible.com/ansible/latest/intro_configuration.html 这个与[Ansible 文档]配置 ...
- 【Ansible 文档】【译文】Ad-Hoc 命令介绍
Introduction To Ad-Hoc Commands Ad-Hoc命令介绍 下面的例子展示了如何使用 /usr/bin/ansible 来运行ad hoc任务. 什么是ad hoc命令? 一 ...
- 【Ansible 文档】【译文】入门教程
http://docs.ansible.com/ansible/latest/intro_getting_started.html Foreword 前言 到这里,你应该已经安装了Ansible,是时 ...
- 【Ansible 文档】【译文】常见问题
http://docs.ansible.com/ansible/latest/faq.html 如何为一个task或者整个Playbook设置PATH或者任意其他环境变量? 通过environment ...
随机推荐
- [ES] 安装
1.ElasticSearch安装的准备工作 Linux:CentOS6.4 Elasticsearc:elasticsearch-2.2.0 JDK:jdk-7u79-linux-x64 IK:1. ...
- ZOJ Problem Set - 1392 The Hardest Problem Ever
放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <std ...
- 探秘Tomcat——连接器和容器的优雅启动
前言: 上篇<探秘Tomcat——启动篇>粗线条的介绍了在tomcat在启动过程中如何初始化Bootstrap类,加载并执行server,从而启动整个tomcat服务,一直到我们看到控制台 ...
- 帮公司人事MM做了个工资条拆分工具
引言 偶尔一次午饭时人事说加班加到8点多,纯手工复制粘贴Excel的内容,公司大概150多人吧,每次发工资时都需要这样手动处理,将一个Excel拆分成150多个Excel,再把里面的内容粘过去,如此循 ...
- 【LeetCode】Palindrome Pairs(336)
1. Description Given a list of unique words. Find all pairs of distinct indices (i, j) in the given ...
- Gobblin采集kafka数据
作者:Syn良子 出处:http://www.cnblogs.com/cssdongl 转载请注明出处 找时间记录一下利用Gobblin采集kafka数据的过程,话不多说,进入正题 一.Gobblin ...
- 基于python的七种经典排序算法
参考书目:<大话数据结构> 一.排序的基本概念和分类 所谓排序,就是使一串记录,按照其中的某个或某些关键字的大小,递增或递减的排列起来的操作.排序算法,就是如何使得记录按照要求排列的方法. ...
- Quartz.net 开源job调度框架(一)
Quartz.NET是一个开源的作业调度框架,非常适合在平时的工作中,定时轮询数据库同步,定时邮件通知,定时处理数据等. Quartz.NET允许开发人员根据时间间隔(或天)来调度作业.它实现了作业和 ...
- sed命令使用详解归纳
用法 sed [option] 'Address Command' yourfile e.g. sed -n '2,13p' lineuser #打印文件lineuser中第2~13行的内容,-n为o ...
- jsp原理
在eclipse里jsp编译后的java和class文件的位置 eclipse版本不一样,位置也不一样第一种:1.java类编译后产生的.class文件在D:\workspace\test\WEB-I ...