centos7下安装ansible
由于centos7预装了python,因此我们可以跳过python的安装环节(记得关闭防火墙)
[root@model ~]#
[root@model ~]# python --version
Python 2.7.
[root@model ~]#
本文使用yum安装ansible
[root@model ~]# yum install epel-release
[root@model ~]# yum install ansible
配置目标服务器192.168.1.10和192.168.1.20(在文件中添加红色部分)
[root@model ~]# vi /etc/ansible/hosts
# This is the default ansible 'hosts' file.
#
# It should live in /etc/ansible/hosts
#
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups # Ex : Ungrouped hosts, specify before any group headers. ## green.example.com
## blue.example.com
## 192.168.100.1
## 192.168.100.10 # Ex : A collection of hosts belonging to the 'webservers' group ## [webservers]
## alpha.example.org
## beta.example.org
## 192.168.1.100
## 192.168.1.110 # If you have multiple hosts following a pattern you can specify
# them like this: ## www[:].example.com # Ex : A collection of database servers in the 'dbservers' group ## [dbservers]
##
## db01.intranet.mydomain.net
## db02.intranet.mydomain.net
## 10.25.1.56
## 10.25.1.57 # Here's another example of host ranges, this time there are no
# leading 0s: ## db-[:]-node.example.com 192.168.1.10
192.168.1.20 ~
~
~
~
~
~
"/etc/ansible/hosts" 47L, 1041C
生成SSH密钥
[root@model ~]# ssh-keygen -t rsa
将/root/.ssh目录下的id_rsa.pub拷贝到目标服务器
[root@model ~]# scp /root/.ssh/id_rsa.pub root@192.168.1.10:/root/.ssh/authorized_keys
[root@model ~]# scp /root/.ssh/id_rsa.pub root@192.168.1.20:/root/.ssh/authorized_keys
测试批量执行ping命令
[root@model ~]#
[root@model ~]# ansible all -m ping
192.168.1.10 | SUCCESS => {
"changed": false,
"ping": "pong"
}
192.168.1.20 | SUCCESS => {
"changed": false,
"ping": "pong"
}
[root@model ~]#
至此,ansible安装完成~
centos7下安装ansible的更多相关文章
- CentOS7 下 安装 supervisor以及使用
CentOS7 下 安装 supervisor 以及使用 手动安装 [注] linux环境必须安装 python 1.获取supervisor包:[https://pypi.python.org/py ...
- Linux CentOs7 下安装 redis
Linux CentOs7 下安装 redis 请将以下命令放入linux命令行中运行 如果安装过程前没有安装GCC请先安装 命令如下 $ yum install gcc-c++ $ wget ht ...
- Centos7下安装配置Redsocks
Redsocks是一个开源的网络程序,代码依赖开源的libevent网络库.Redsocks允许你将所有TCP连接重定向到SOCKS或HTTPS代理,比如Shadowsocks(Centos7下安装配 ...
- CentOS7下安装SVN服务端
CentOS7下安装SVN服务 1. yum命令即可方便的完成安装# sudo yum install subversion 测试安装是否成功:# svnserve --version 更改svn的默 ...
- centOS7下安装GUI图形界面
1.如何在centOS7下安装GUI图形界面 当你安装centOS7服务器版本的时候,系统默认是不会安装GUI的图形界面程序,这个需要手动安装CentOS7 Gnome GUI包. 2.在系统下使用命 ...
- CentOS7下安装MySQL并配置远程连接
一.CentOS7下安装MySQL数据库 CentOS7默认的安装包里面已经没有 MySQL-Server安装包了,远程镜像中也没有了. 默认的是MariaDB (MySQL的一个分支,开发这个分支的 ...
- Docker学习笔记3:CentOS7下安装Docker-Compose
Docker-Compose是一个部署多个容器的简单但是非常必要的工具. 安装Docker-Compose之前,请先安装 python-pip,请参考我的另一篇博文CentOS7下安装python-p ...
- docker(一) Centos7下安装docker
docker(一) Centos7下安装dockerdocker(二) windows10下安装dockerdocker(三) 镜像和容器常用命令 docker(四) 使用Dockerfile构建镜像 ...
- centos7 下 安装部署nginx
centos7 下 安装部署nginx 1.nginx安装依赖于三个包,注意安装顺序 a.SSL功能需要openssl库,直接通过yum安装: #yum install openssl b.gzip模 ...
随机推荐
- [read -p应用]插拔光模块去检查port present状态
#!/bin/bash path="/sys/devices/platform/soc/fd880000.i2c-pld/i2c-0/i2c-4/i2c-15/15-0060" a ...
- centos将celery写入系统服务
第一步: 在/etc/下创建目录 celery/celery.conf 代码如下: CELERYD_NODES='w1 w2 w3' # 启动的celery进程的进程名 CELERY_BIN='/ro ...
- 多线程server与多client通信
鉴于ServerSocket的accept方法是阻塞的,那么只能通过多线程的方式实现多客户端连接与服务器连接 基本步骤: 1,服务端创建ServerSocket绑定端口号,循环调用accept()方法 ...
- windows安装ActiveMQ以及点对点以及发布订阅
一.MQ产品的分类 1.RabbitMQ 是使用Erlang编写的一个开源的消息队列,本身支持很多的协议:AMQP,XMPP, SMTP, STOMP,也正是如此,使的它变的非常重量级,更适合于企业级 ...
- 让eclipse恢复默认布局
参考:https://blog.csdn.net/howlaa/article/details/39178359 Window -> Perspective -> Reset Perspe ...
- Python之json库
JSON简介 JSON (JavaScript Object Notation) 是一种用于表示结构化数据的流行数据格式. 常用于服务器和Web应用程序之间传输和接收数据. 在Python中,JSON ...
- [理解] Linux 作为一个服务器是怎样的存在 (一)
长期以来我就一直有一个疑问, 为什么当我们选择使用服务器的时候都会选择 Linux 作为操作系统, 以至于只要说到服务器就会不由自主的想到Linux, 那么Linux到底是什么呢? 当然我也不会妄谈天 ...
- MyuCMS_V2.1漏洞分析
前言 在CNVD看到一个MyuCMS的一个任意文件删除漏洞.然后去搜了下这个CMS,发现官网公告显示在V2.2.3版本修复了CNVD提供的多处漏洞. 怀着好奇的心里,去CNVD搜了下这个CMS,结果发 ...
- JS回弹原理-高级
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jqGrid 复选框实现单选
参考:https://blog.csdn.net/java0311/article/details/45575517