当前位置: 首页 > news >正文

ansible远程执行命令

一、ansible简介

需要在一台机器上搭建ansible环境,且配置目的ip的密码,通道没有问题即可下发命令

使用的通道是ssh(端口:36000)

二、搭建细节

1、安装ansible

yum install -y ansible

2、把目的ip密码写到配置文件中

vim /etc/ansible/hosts

配置文件例如,

[outside_muji]
你的IP	ansible_ssh_user=root ansible_ssh_port=36000  ansible_ssh_pass=你的密码
你的IP	ansible_ssh_user=root ansible_ssh_port=36000  ansible_ssh_pass=你的密码

3、修改免密登录

vim /etc/ansible/ansible.cfg
在文件中进行搜索定位
:/host_key_checking修改前:
# uncomment this to disable SSH key host checking
#host_key_checking = False
修改后:
# uncomment this to disable SSH key host checking
host_key_checking = False

4、执行你想批量执行的命令

ansible outside_muji -m shell -a "date"
http://www.lryc.cn/news/131521.html

相关文章:

  • Windows快速恢复丢失的颜色校准
  • Vue安装单文件组件
  • 小白的Node.js学习笔记大全---不定期更新
  • 第二周晨考自测(2.0)
  • 计算机视觉之三维重建(三)(单视图测量)
  • docker 批量快速删除容器和镜像
  • 【数据分析入门】Matplotlib
  • mongodb.使用自带命令工具导出导入数据
  • IndexError: tensors used as indices must be long, byte or bool tensors
  • 设计模式 : 单例模式笔记
  • 深度优先搜索算法
  • k8s ----POD控制器详解
  • ReactNative进阶(三十四):ipa Archive 阶段报错error: Multiple commands produce问题修复及思考
  • MySQL索引ES索引
  • webSocket 聊天室 node.js 版
  • iptables防火墙(SNAT与DNAT)
  • 第 359 场 LeetCode 周赛题解
  • 【开源项目】Stream-Query的入门使用和原理分析
  • 微信小程序picker组件的简单使用 单选
  • python、numpy、pytorch中的浅拷贝和深拷贝
  • EasyRecovery14数据恢复软件支持各类存储设备的数据恢复
  • 玩机搞机----面具模块的组成 制作模块
  • 注册中心/配置管理 —— SpringCloud Consul
  • Next.js 13 你需要了解的 8 件事
  • 计数排序(Count Sort)算法详解
  • Linux驱动开发(Day3)
  • 使用Vscode调试shell脚本
  • OpenAI Function calling
  • 【C语言】字符分类函数、字符转换函数、内存函数
  • Deep Learning With Pytorch - 最基本的感知机、贯序模型/分类、拟合