Centos7.5 执行ansible命令报错

问题:

[root@m01 ~]# ansible servers -a "hostname|grep web" -i ./hosts
172.16.1.7 | FAILED | rc=2 >>
[Errno 2] No such file or directory

原因:

默认使用的是command模块,command模块不能使用管道

解决方法:

使用shell模块执行命令
[root@m01 ~]# ansible servers -m shell -a "hostname|grep web" -i ./hosts
172.16.1.7 | CHANGED | rc=0 >>
web01

[Errno 2] No such file or directory的更多相关文章

  1. RHEL 5.7 Yum配置本地源[Errno 2] No such file or directory

    在Red Hat Enterprise Linux Server release 5.7 上配置YUM本地源时,遇到了"Errno 5] OSError: [Errno 2] No such ...

  2. VSCode python 遇到的问题:vscode can't open file '<unprintable file name>': [Errno 2] No such file or directory

    代码很简单,就两行: import pandas as pd import netCDF4 as nc dataset = nc.Dataset('20150101.nc') 环境:在VSCode中左 ...

  3. can't open file 'manage.py': [Errno 2] No such file or directory

    python Django创建数据库时can't open file 'manage.py': [Errno 2] No such file or directory 参考https://blog.c ...

  4. ansible执行shell模块和command模块报错| FAILED | rc=127 >> /bin/sh: lsof: command not found和| rc=2 >> [Errno 2] No such file or directory

    命令: ansible -i hosts_20 st  -m shell -a 'service zabbix_agentd star'  -K --become ansible -i hosts_2 ...

  5. 关于python中的 “ FileNotFoundError: [Errno 2] No such file or directory: '……'问题 ”

    今天在学python时,在模仿一个为图片加上图标并移动到指定文件夹的程序时遇到“FileNotFoundError: [Errno 2] No such file or directory: '152 ...

  6. python文件操作的坑( FileNotFoundError: [Errno 2] No such file or directory...)

    环境:Windows8.1, Python3.6  pycharm community 2017   c盘下有一个配置文件:setup   with open('c:\\setup','r') as ...

  7. os.chdir("/deepmatching") OSError: [Errno 2] No such file or directory: '/deepmatching'

    #os.chdir("/deepmatching")os.chdir(os.path.dirname(os.path.abspath("deepmatching1&quo ...

  8. Docker build 安装报错, Could not open requirments file: [Errno 2] No such file or directory:'requirements.txt'

    docker安装教程 https://docs.docker.com/get-started/part2/#build-the-app 相关帖子 https://stackoverflow.com/q ...

  9. py2exe error: [Errno 2] No such file or directory: 'MSVCP90.dll'

    使用 python setup.py py2exe 打包时出现 py2exe error: [Errno 2] No such file or directory: 'MSVCP90.dll' 解决方 ...

随机推荐

  1. unity3d-游戏实战突出重围,第二天 制作血条

    using UnityEngine; using System.Collections; public class xt : MonoBehaviour { //红色血条 public Texture ...

  2. Minecraft 1.8.9 FML Mod 开发教程

    Mod开发教程 https://fmltutor.ustc-zzzz.net/

  3. Beta冲刺1.0

    1. 提供当天站立式会议照片一张 2. 每个人的工作 (有work item 的ID) 3. 发布项目燃尽图 4. 每人的代码/文档签入记录 (1)代码签入记录 (2)代码签入链接   链接1   链 ...

  4. centos下jdk、jre安装

    1.在/usr/目录下创建java目录 [root@localhost ~]# mkdir/usr/java [root@localhost ~]# cd /usr/java 2.下载jdk,然后解压 ...

  5. 06 str() bytes() 编码转换

    x = str() #创建字符串#转换成字符串,字节,编码 m = bytes()#创建字节#转换成字节,字符串,要编程什么编码类型的字节 a = "李露" b1 = bytes( ...

  6. Java 内存分配

    静态储存区:全局变量,static 内存在编译的时候就已经分配好了,并且这块内存在程序运行期间都存在. 栈储存区:1,局部变量.2,,保存类的实例,即堆区对象的引用.也可以用来保存加载方法时的帧.函数 ...

  7. 关于JS的几个基础题目

    1.截取字符串abcdefg的efg alert("abcdefg".substring(4)); 2.判断一个字符串中出现次数最多的字符,统计这个次数 var str = 'as ...

  8. flask 使用Flask-WTF处理表单

    使用Flask-WTF处理表单 扩展Flask-WTF继承了WTFforms,使用它可以在flask中更方便的使用WTForms.Flask-WTF将表单数据解析.CSRF保护.文件上传等功能与Fla ...

  9. 20165215 2017-2018-2 《Java程序设计》第2周学习总结

    20165215 2017-2018-2 <Java程序设计>第2周学习总结 教材学习内容总结 chapter2 逻辑类型boolea只能赋值true或false Java没有无符号整数类 ...

  10. vue生命周期图示中英文版Vue实例生命周期钩子

    vue生命周期图示中英文版Vue实例生命周期钩子知乎上近日有人发起了一个 “react 是不是比 vue 牛皮,为什么?” 的问题,Vue.js 作者尤雨溪12月4日正面回应了该问题.以下是尤雨溪回复 ...