zoukankan      html  css  js  c++  java
  • ansible-playbook 显示命令返回结果

    ---
    - hosts: test
      gather_facts: F   #开启debug
      vars:
        war: "ps -ef | grep tomcat | grep -v grep | awk '{print $2}'"
      tasks:
      - name: stop tomcat
        shell: nohup /bin/bash /tmp/stop_tomcat.sh&
        ignore_errors: True
        register: tomcat_out  #定义变量存储返回的结果
      - name: show 结果       #定义输出结果的task
        debug: var=tomcat_out verbosity=0    #debug的模块显示输出的记过
      - name: back war
        shell: cp /home/admin/taobao-tomcat-production-7.0.59.3/deploy/ROOT.war /tmp/
      - name: remove romate dir
        file: path=/home/admin/taobao-tomcat-production-7.0.59.3/deploy/ROOT state=absent
      - name: remove romate war
        file: path=/home/admin/taobao-tomcat-production-7.0.59.3/deploy/ROOT.war state=absent
      - name: copy war
        copy: src=/home/admin/.jenkins/jobs/NET-hangfa/workspace/aecc_purchase_portal_web/xx.war  dest=/home/admin/taobao-tomcat-production-7.0.59.3/deploy/ROOT.war owner=admin group=wheel mode=0644
      - name: start tomcat
        shell: nohup sh /home/admin/taobao-tomcat-production-7.0.59.3/bin/startup.sh &
      - name: tomcatalive
        shell: "{{war}}"
        register: check
      - name: show
        debug: var=check.stdout verbosity=0    #check.stdout 显示出的信息会看的更清晰点

      

  • 相关阅读:
    Xcode编译报错信息总结
    iOS组件化方案
    xcodebuild命令
    Mac下配置MAMP Pro+PHPStorm
    Sublime Text PHP Mac系统环境配置
    JS生成二维码
    为IE和chrome编写单独的样式
    几个简单的VBS脚本程序以及其JS实现
    vue组件中使用iframe元素
    nginx简易部署
  • 原文地址:https://www.cnblogs.com/dingbin/p/10250715.html
Copyright © 2011-2022 走看看