• ansible


    黄色:成功执行并伴随着状态的改变

    绿色:成功执行并且没有发生状态的改变

    红色:执行失败

    灰紫:表示对命令执行发出警告信息,(可能存在问题,给你建议一下)

    yum install -y ansible

    ansible主机往其他方向需要ssh信任

    ssh-keygen -t rsa

    ssh-copy-id .ssh/id_rsa.pub 172.16.0.222

    ssh-copy-id .ssh/id_rsa.pub 172.16.0.223

    vim /etc/ansible/hosts 添加

    [web]
    172.16.0.222

    [mariadb]
    172.16.0.223

    [test:children]
    web
    mariadb

    ansible test -m ping

    ------------------------------------------------------

    172.16.0.223 | SUCCESS => {
    "changed": false,
    "ping": "pong"
    }
    172.16.0.222 | SUCCESS => {
    "changed": false,
    "ping": "pong"
    }

    ------------------------------------------------------

    [root@ansible ~]# ansible web -m yum -a 'name=screen state=install'
    172.16.0.222 | FAILED! => {
    "changed": false,
    "msg": "value of state must be one of: absent,present,installed,removed,latest, got: install"
    }
    [root@ansible ~]# ansible web -m yum -a 'name=screen state=removed'
    172.16.0.222 | SUCCESS => {
      "changed": false,
      "msg": "",
      "rc": 0,
      "results": [
        "screen is not installed"
      ]
    }

    -----------------------------------------------------------------------------------

  • 相关阅读:
    PHP异常与错误处理机制
    工作中图片上传遇到的一个问题
    PHP遍历目录四种方法
    ssh框架中.xml文件小技巧分离xml
    读取XML文件内容
    spring_AOP
    spring_AOP_XML
    spring_AOP_annotation
    js异步刷新局部页面
    HQL count(*)
  • 原文地址:https://www.cnblogs.com/Leaders543/p/12557491.html
Copyright © 2020-2023  润新知