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 显示出的信息会看的更清晰点

      

  • 相关阅读:
    win10 uwp 模拟网页输入
    PHP prev() 函数
    PHP pos() 函数
    PHP next() 函数
    PHP natsort() 函数
    PHP natcasesort() 函数
    virtualenv
    自古枪兵幸运E
    win10 uwp DataContext
    win10 uwp DataContext
  • 原文地址:https://www.cnblogs.com/dingbin/p/10250715.html
Copyright © 2011-2022 走看看