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. HTML5 缓存

    一.在html/htm文件中声明缓存,声明方式: <!DOCTYPE HTML> <html manifest="demo.appcache">...3 & ...

  2. phpcs

    phpcs(代码规范) https://juejin.im/post/5b18fdeb6fb9a01e573c3cb3 https://laravel-china.org/docs/psr/psr-2 ...

  3. java字符串转换总结

    1.byte[]转String String str = new String(strByte); 2.String转byte[] byte[] byteArr = str.getBytes(); 3 ...

  4. github常见错误提示之一

    如果输入$ Git remote add origin git@github.com:Jomsou(github帐号名)/gitdemo(项目名).git 提示出错信息:fatal: remote o ...

  5. mysql主从配置,读写分离

    Mysql主从配置,实现读写分离 大型网站为了软解大量的并发访问,除了在网站实现分布式负载均衡,远远不够.到了数据业务层.数据访问层,如果还是传统的数据结构,或者只是单单靠一台服务器扛,如此多的数据库 ...

  6. sitecore系统教程之体验编辑器

    体验编辑器是一个WYSIWYG编辑器,允许您直接在页面上轻松更改项目.您可以编辑页面上可见的所有项目 - 文本,图形,徽标,链接等. 在体验编辑器中,您可以编辑当前项目的字段以及页面上呈现的任何项目的 ...

  7. Spark学习之路 (九)SparkCore的调优之数据倾斜调优

    摘抄自:https://tech.meituan.com/spark-tuning-pro.html 数据倾斜调优 调优概述 有的时候,我们可能会遇到大数据计算中一个最棘手的问题——数据倾斜,此时Sp ...

  8. Maven依赖中的scope详解,在eclipse里面用maven install可以编程成功,到服务器上用命令执行报VM crash错误

    Maven依赖中的scope详解 项目中用了<scope>test</scope>在eclipse里面用maven install可以编译成功,到服务器上用命令执行报VM cr ...

  9. Matlab基础部分1

  10. JustOj 2009: P1016 (dp)

    题目描述 有一个箱子容量为v(正整数,o≤v≤20000),同时有n个物品(o≤n≤30),每个物品有一个体积  (正整数).要求从  n  个物品中,任取若干个装入箱内,使箱子的剩余空间为最小.  ...