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

      

  • 相关阅读:
    sqlilab less19-less22
    sqlilab less11-less18
    逆向——序列号相关总结
    xctf攻防世界——crackme writeup
    ESP定律脱壳——NsPack3.x脱壳
    避免全局变量漫天飞
    C语言实现队列
    STM32中的C语言知识点
    超时事件时间戳
    STM32-电源控制、低功耗模式
  • 原文地址:https://www.cnblogs.com/dingbin/p/10250715.html
Copyright © 2020-2023  润新知