• [WARNING]: Could not match supplied host pattern, ignoring: servers


    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
  • 相关阅读:
    font-weight(字体粗细)属性
    Node.js入门(三)
    js难点问题
    Node.js入门(二)
    Node.js入门(一)
    Reactjs的Controller View模式
    智能社的邀请码
    react native 学习资料汇总
    jquery操作select
    分享
  • 原文地址:https://www.cnblogs.com/lvhanzhi/p/10439228.html
Copyright © 2020-2023  润新知