Centos7.5 ansible执行命令报错

问题:

[root@m01 ~]# ansible servers -a "hostname"
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit
localhost does not match 'all' [WARNING]: Could not match supplied host pattern, ignoring: servers

原因:

没有添加主机清单

解决方法:

方式一:
[root@m01 ~]# vim /etc/ansible/hosts
[webservers]
172.16.1.7
[mysqlservers]
172.16.1.8
[servers:children]
webservers
mysqlservers
[root@m01 ~]# ansible servers -a "hostname"
172.16.1.8 | CHANGED | rc=0 >>
web02
172.16.1.7 | CHANGED | rc=0 >>
web01
方式二:
[root@m01 ~]# vim hosts
[webservers]
172.16.1.7
[mysqlservers]
172.16.1.8
[servers:children]
webservers
mysqlservers
[root@m01 ~]# ansible servers -a "hostname" -i ./hosts
172.16.1.8 | CHANGED | rc=0 >>
web02
172.16.1.7 | CHANGED | rc=0 >>
web01

[WARNING]: Could not match supplied host pattern, ignoring: servers的更多相关文章

  1. wget命令使用报错 certificate common name 'xxx' doesn't match requestde host name

    使用wget命令 wget http://www.monkey.org/~provos/libevent-1.2.tar.gz 报如下错 error:certificate common name & ...

  2. wget 无法建立ssl连接 [ERROR: certificate common name ?..ssl.fastly.net?.doesn?. match requested host name ?.ache.ruby-lang.org?. To connect to cache.ruby-lang.org insecurely, use ?.-no-check-certificate?]

    通过wget下载文件,报错 [root@Redmine-186 opt]# wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.6.tar.g ...

  3. ubuntu使用git的时:Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.

    1:问题现象: hlp@hlp:~/code/github_code/catch_imooc1$ git push origin master Warning: Permanently added t ...

  4. tomcat日志警告WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.

    日志中有警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did ...

  5. Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts. Permission denied (publickey). fatal: Could not read from remote repository. Please make sure y

    这个应该是很多github新手经常出错的问题,这个就是没有在你github上添加一个公钥. 下面就直接说步骤: 1 可以用 ssh -T git@github.com去测试一下 图上可以明显看出缺少了 ...

  6. Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.

    如果出现这个问题,说明你的github缺少公钥 使用 ssh -T git@gtihub.com 去测试 1.生成密钥 ssh-keygen -t rsa -C "your name&quo ...

  7. 记录k8s:k8s1.8.4无坑离线安装

    安装部署: 1. 使用vagrant 准备3太虚拟机,自己使用Vbox 准备3太也可以. 2. 按照 https://github.com/gjmzj/kubeasz 安装. 3. 使用letsenc ...

  8. django集成ansibe实现自动化

    动态生成主机列表和相关参数 def create_admin_domain(admin_node): workpath = BASE_DIR + '/tools/ansible/script' hos ...

  9. 1、Ansible简介及简单安装、使用

    参考Ansible权威指南:https://ansible-tran.readthedocs.io/en/latest/index.html 以下内容学习自马哥教育 Ansible: 运维工作:系统安 ...

随机推荐

  1. php开启pdo扩展

    在Windows环境下php 5.1以上版本中,pdo和主要数据库的驱动同php一起作为扩展发布,要激活它们只需要简单地编辑php.ini文件. 打开php.ini配置文件,找到extension=p ...

  2. RN项目中使用react-native-elements报错: Unrecognized font family 'Material Icons'

    查询了一些方案,但各自的环境不尽相同,最后在google中找到了答案.主要问题在于 (1)版本问题 (2)Xcode配置问题 报错如下 解决步骤: 1 . 首先需要正确安装 npm i -S reac ...

  3. wordpress学习(五)----插件

    wordpress加载顺序:首先加载插件,再加载主题中的functions.php,初始化一些数据之类的,最后加载模板了!!! update_option("hc_copyright_tex ...

  4. lua学习之循环打印九九乘法表

    --第4题 输出99乘法表 function PrintMulitiplyTable() , do local res = {} local str = "" , i do res ...

  5. 擠出線寬(Extrusion width),要怎麼設定?

    擠出線寬(Extrusion width),要怎麼設定? Slic3r的作者,把這邊的%設定,跟"層高"做連結.我個人認為擠出線寬,要以噴頭孔徑當做設定參考才好.層高應該只要設定成 ...

  6. JavaScript--元素对象方法setAttribute() 和appendChild()

    appendChild() 方法可向节点的子节点列表的末尾添加新的子节点 setAttribute() 方法创建或改变某个新属性.如果指定属性已经存在,则只设置该值 <!DOCTYPE html ...

  7. Eureka (数学组合 + 斜率)

    由于斜率的储存精度不够,所以使用最简分数表示记录. 合并同一个位置上的点,然后统计个数,利用公式先求出至少包含2个点的数量. 然后再是求某位之上的点与某一斜率的个数,那就是每边至少一个点的个数相乘. ...

  8. js三目学习

    <script> var n=1; n>1?document.write('大于1哦'):document.write('小于或等于1哦') //n=n>1?document. ...

  9. javamail发送邮件及错误解决方法javax.mail.AuthenticationFailedException: failed to connect, no password specified?

    javamail发送邮件及错误解决方法javax.mail.AuthenticationFailedException: failed to connect, no password specifie ...

  10. maven 入门 (一)

    纠结了好久,到底要不要写一份maven入门的所谓“教程”,有好几次想写一下,但是都放弃了,因为网上的太多了,而且都很好,但是现在决定了,还是要写出来,因为者有我自己的理解.所以我想写一份教程出来. 首 ...