1 在最新的ubuntu系统上安装ansible : sudo ape-get install ansible

2 切换到root用户 生成ssh免密登陆

  ssh-keygen -t rsa

  ssh-copy-id -i /root/.ssh/id_rsa.pub root@ip(ip是被ansible管理的节点地址)

  

root@pxy-p:/etc/ansible# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:AsNJM46Bt5GCyQtaNXQOik+hKDAD9hRQZkIuMz3I/1g root@pxy-p
The key's randomart image is:
+---[RSA 2048]----+
|XB=XX . |
|%O@O O |
|%*B+* . |
|+*o. o |
| .. E. S |
| + . |
| . . |
| |
| |
+----[SHA256]-----+
root@pxy-p:/etc/ansible# ssh-copy-id -i /root/.ssh/id_rsa.pub root@100.98.40.134
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@100.98.40.134's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@100.98.40.134'"
and check to make sure that only the key(s) you wanted were added. root@pxy-p:/etc/ansible# ssh 100.98.40.134
Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.15.0-29-generic x86_64) * Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage 6 个可升级软件包。
0 个安全更新。 Last login: Tue Oct 30 16:29:25 2018 from 100.98.40.167
root@pxy-snow:~# exit
注销
Connection to 100.98.40.134 closed.
root@pxy-p:/etc/ansible#

如果ssh 免秘钥登陆节点失败:

  

解决方法:

1) 以root身份,chmod +w /etc/ssh/sshd_config

2) vi /etc/ssh/sshd_config

3) 将PermitRootLogin no改成PermitRootLogin yes

4) service sshd restart

ubuntu上安装ansible的更多相关文章

  1. [异常解决] ubuntu上安装JLink驱动遇到的坑及给后来者的建议

    一.前言 最近将整个电脑格式化,改成了linux操作系统 希望这样能让自己在一个新的世界探索技术.提升自己吧- win上的工具用多了,就不想变化了- 继上一篇<ubuntu上安装虚拟机遇到的问题 ...

  2. Ubuntu上安装Robomongo及添加到启动器

    到目前为止,Robomongo仍是MongoDB最好的客户端管理工具,如需在Ubuntu上安装Robomongo,可直接从官网下载.tar.gz压缩包进行解压,然后直接运行bin目录下的robomon ...

  3. 在 Ubuntu 上安装 Android Studio

    在 Ubuntu 上安装 Android Studio http://www.linuxidc.com/Linux/2013-05/84812.htm 打开terminal,输入以下命令 sudo a ...

  4. Ubuntu上安装Karma失败对策

    在Ubuntu上安装Karma遇到超时 timeout 错误.Google了一下,国外的码农给了一个快捷的解决方案,实测可行,贴在这里: sudo apt-get install npm nodejs ...

  5. 在Ubuntu上安装LAMP服务器

    1.安装Ubuntu上安装LAMP apt-get install lamp-server^ 2.安装过程中设置MySql密码 3.测试 创建index.php var/www/html/index. ...

  6. [译]How to Setup Sync Gateway on Ubuntu如何在ubuntu上安装sync-gateway

    参考文章https://hidekiitakura.com/2015/03/21/how-to-setup-sync-gateway-on-ubuntudigitalocean/ 在此对作者表示感谢 ...

  7. 在Ubuntu上安装JDK、Ant、Jmeter和Jenkins

    一.前期准备 1. 在win7下载VMware.Ubuntu(用迅雷下比较快) 2. 安装完VMware后新建虚拟机,选择iso: 3. 具体配置参考如下,至此Ubantu安装完成 二.在Ubuntu ...

  8. Ubuntu上安装MongoDB(译)

    add by zhj:直接从第四步开始就可以了,而且安装好MongoDB后会自动启动的,不必自己去执行启动命令 原文:https://docs.mongodb.com/manual/tutorial/ ...

  9. Ubuntu上安装ns2-2.34

    Ubuntu上安装ns2-2.34 步骤1 下载ns-allinone-2.34 $ tar zxf ns-allinone-2.34.tar.gz 步骤2 sudo apt-get install ...

随机推荐

  1. RQNOJ 569 Milking Time:dp & 线段问题

    题目链接:https://www.rqnoj.cn/problem/569 题意: 在一个数轴上可以摆M个线段,每个线段的起始终止端点给定(为整数),且每个线段有一个分值,问如何从中选取一些线段使得任 ...

  2. riverbed 流量分析——还是在基于流量做运维

    from:https://www.riverbed.com/sg/digital-performance/index.htmlMaximise Your Digital PerformanceConn ...

  3. 企业安全建设之搭建开源SIEM平台(上)

    前言 SIEM(security information and event management),顾名思义就是针对安全信息和事件的管理系统,针对大多数企业是不便宜的安全系统,本文结合作者的经验介绍 ...

  4. [原创]Java动态生成word文档(图文并茂)

    很多情况下,软件开发者需要从数据库读取数据,然后将数据动态填充到手工预先准备好的Word模板文档里,这对于大批量生成拥有相同格式排版的正式文件非常有用,这个功能应用PageOffice的基本动态填充功 ...

  5. redis持久化的方式RDB 和 AOF

    redis持久化的方式RDB 和 AOF 一.对Redis持久化的探讨与理解 目前Redis持久化的方式有两种: RDB 和 AOF 首先,我们应该明确持久化的数据有什么用,答案是用于重启后的数据恢复 ...

  6. cmder的下载和使用

    下载地址:http://cmder.net/ 设置环境变量,CMDER_HOME=cmder.exe所在目录,并在path中增加%CMDER_HOME%. 右击我的电脑->属性->(左侧) ...

  7. HDU 1166 敌兵布阵 (线段树单点修改和区间和查询)

    Input 第一行一个整数T,表示有T组数据.每组数据第一行一个正整数N(N<=50000),表示敌人有N个工兵营地,接下来有N个正整数,第i个正整数ai代表第i个工兵营地里开始时有ai个人(1 ...

  8. 【Lintcode】087.Remove Node in Binary Search Tree

    题目: Given a root of Binary Search Tree with unique value for each node. Remove the node with given v ...

  9. Visual Studio 编译后去掉只读属性

    Visual Studio 编译后去掉只读属性 attrib $(TargetPath) -R attrib $(TargetDir)$(TargetName).pdb -R

  10. CentOS下编写shell脚本来监控MySQL主从复制的教程

    这篇文章主要介绍了在CentOS系统下编写shell脚本来监控主从复制的教程,文中举了两个发现故障后再次执行复制命令的例子,需要的朋友可以参考下 目的:定时监控MySQL主从数据库是否同步,如果不同步 ...