[Errno 2] No such file or directory

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

原文地址:https://www.cnblogs.com/lvhanzhi/p/10439257.html

时间: 2024-08-30 11:20:45

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

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_20 st  -m shell -a 'lsof -i:10050'  -K --become 在shell模块报错:| FAILED | rc=127 >>/bin/sh: lsof: command not found 在command模块报错:| rc=2 >>[Errno 2]

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

环境:Windows8.1, Python3.6  pycharm community 2017 c盘下有一个配置文件:setup 1 with open('c:\\setup','r') as f: 2 f.read() 提示一直很诡异:FileNotFoundError: [Errno 2] No such file or directory: 'c:\\setup' 网上有大量关于Python编码错误导致无法打开文件的解决方法,utf8 gbk2312,尝试过一遍全部无效 最后原因很乌龙:

使用py2exe 将python文件转成exe文件(以及 error: [Errno 2] No such file or directory: 'MSVCP90.dll'解决方法)

用python写程序真的很简单,当我们开发出功能后,特别是带窗体的python程序,需要将python程序转成双击运行的exe程序.我们需要一个第三方模块 py2exe,就是将py转成exe的模块.只需py2exe怎么安装,我这里就不详细说明了,直接到官网上下载对应python的py2exe版本,然后是傻瓜式安装,并且安装好后py2exe模块会自动添加到python的路径中. 然后就简单了,我们在要被转换成exe的py文件目录下新建一个 setup.py 文件,将代码贴进去: #coding=u

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

今天在学python时,在模仿一个为图片加上图标并移动到指定文件夹的程序时遇到"FileNotFoundError: [Errno 2] No such file or directory: '1528712892362.jpg'"这个问题. 讲讲解决方案,因为我要处理的十几张图片是位于 'F:\图片' 这个路径下的,但是读取到具体的某一个文件时忘记使用绝对路径,如果没有为文件加上前面的绝对路径的话,我的理解是默认在程序所在的路径作为当前路径来查找的,所以就会报错说找不到文件. 后来加

Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt

最近安装python,已经安装好,cmd终端中输入python.pip等命令都有用 然而在配置requirements.txt文件过程中,执行语句 “pip install -r requirement.txt” 时报错 “Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'”, 经过一番折腾,查出原因是在执行这一语句前需要先创建requirements.txt 文件,所

OSError: [Errno 2] No such file or directory

执行Python脚本时,报如下错误: ['mkdir -p /tmp/gluster_volume_files.can.not.delete'] [E 150529 11:36:14 web:1030] Uncaught exception GET /api/v1/volume/df/tank (10.58.164.150) HTTPRequest(protocol='http', host='10.160.140.23:8000', method='GET', uri='/api/v1/vol

Yum:[Errno 5] [Errno 2] No such file or directory

yum安装软件时,可以连接yum 仓库,但是下载安装时失败,报错如下 [email protected]/0 # yum install httpd 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors-internal.yyhu.com * extras: mirrors-internal.yyhu.com * updates: mirrors-internal.yyh

FileNotFoundError: [Errno 2] No such file or directory的解决方法

1.获取当前文件所在路径 basedir = os.path.dirname(__file__) print("basedir:" + basedir) 2.将路径进行拼接 upload_path = os.path.join(basedir, "static/upload", filename) 原文地址:https://www.cnblogs.com/zengsf/p/9882824.html

python smbus IOError: [Errno 2] No such file or directory

1.打开配置文件 sudo nano /boot/config.txt 打开以下选项 "dtparam=i2c_arm=on" ctrl + o 保存 ctrl + x 退出 2.刷新配置文件 sudo raspi-config 3.打开 I2c选项 4.重启 5.再次运行 参考: https://www.raspberrypi.org/forums/viewtopic.php?t=100189 原文地址:https://www.cnblogs.com/sea-stream/p/111