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. 记录一则FGA审计“A用户对B用户某张表的更新操作”需求

    环境:Oracle 11.2.0.4 我这里测试A用户为JINGYU,要审计的表为B用户SCOTT下的EMP表.通过FGA来实现. 1.添加审计策略 2.测试审计效果 3.控制审计策略 1.添加审计策 ...

  2. 发布网站配置文件和SSL

    1.将cert下新建一个文件将所有证书文件放在新建的文件下 例如:cert/medcard 2.配置网站的.conf文件 <VirtualHost *:443> ServerName ww ...

  3. java数据结构和算法编程作业系列篇-数组

    /** * 编程作业 2.1 向highArray.java程序(清单2.3)的HighArray类添加一个名为getMax()的方法,它返回 数组中最大关键字的值,当数组为空时返回-1.向main( ...

  4. beego 初体验 - orm - 增删改查

    本文记录一下 beego orm 简单的增删改查,大牛请绕道. 首先,注册4个增删改查的路由: 其次,在 views 文件夹下增加对应的模板(页面): controller 类里写上增删改查的方法: ...

  5. 混合型log,info按大小分,error按日期

    1.配置文件 <?xml version="1.0" encoding="utf-8"?> <configuration> <!- ...

  6. Python全栈-day14-模块和包

    一.模块 1.模块 1)定义 一系列功能的集合体,在Python中py文件就是一个模块 2)模块的类别 a.使用Python编写的py文件 b.已经被编译成共享库或者DLL的C 或者 C++ 扩展 c ...

  7. ubuntu安装rvm

    sudo apt-get install curl git-core bash -s stable < <(curl -s https://raw.github.com/wayneeseg ...

  8. css解决无论页面长短footer永远置底

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. Robot Framework 遇到过的错误 1. Chrome打开无法数据网址,地址栏只显示data:,

    问题描述:用RF打开网页时未跳转到指定网址,而是显示data:, *** Settings ***Library SeleniumLibrary *** Test Cases ***Login_Tes ...

  10. uvalive 3415 Guardian Of Decency

    题意: 有一个老师想组织学生出去旅游,为了避免他们之间有情侣产生,他制定了一系列的条件,满足这些条件之一,那么这些人理论上就不会成为情侣: 身高相差40cm:性别相同:喜欢的音乐风格不同:最喜欢的运动 ...