java.restart-all.yml 9.57 KB
---

#gateway
- hosts: java-gateway
  serial: "50%"
  vars:
    deploy_path: yoho-gateway
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"


#activity
- hosts: java-activity
  serial: "50%"
  vars:
    deploy_path: yohobuy-activity
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#bigdata
- hosts: java-bigdata
  serial: "50%"
  vars:
    deploy_path: yohobuy-bigdata
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#brower
- hosts: java-brower
  serial: "50%"
  vars:
    deploy_path: yohobuy-brower
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#erp-gateway
- hosts: java-erpgateway
  serial: "50%"
  vars:
    deploy_path: yoho-erp-gateway
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#message
- hosts: java-message
  serial: "50%"
  vars:
    deploy_path: yoho-message
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#order
- hosts: java-order
  serial: "50%"
  vars:
    deploy_path: yohobuy-order
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#product
- hosts: java-product
  serial: "50%"
  vars:
    deploy_path: yohobuy-product
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#promotion
- hosts: java-promotion
  serial: "50%"
  vars:
    deploy_path: yohobuy-promotion
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#resources
- hosts: java-resources
  serial: "50%"
  vars:
    deploy_path: yohobuy-resources
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#risk
- hosts: java-risk
  serial: "50%"
  vars:
    deploy_path: yohobuy-risk
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#sns
- hosts: java-sns
  serial: "50%"
  vars:
    deploy_path: yoho-sns
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#uic
- hosts: java-uic
  serial: "50%"
  vars:
    deploy_path: uic
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#sns
- hosts: java-union
  serial: "50%"
  vars:
    deploy_path: yohobuy-union
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#users
- hosts: java-users
  serial: "50%"
  vars:
    deploy_path: yoho-users
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"



#wechat
- hosts: java-wechat
  serial: "50%"
  vars:
    deploy_path: yohobuy-wechat
  remote_user: root
  become: true
  become_method: sudo
  become_user: master
  tasks:
  - name: restart {{ deploy_path }}
    shell: sh /home/master/{{ deploy_path }}/deploy/bin/killws.sh && sh /home/master/{{ deploy_path }}/deploy/bin/startws.sh
    async: 60
 
  - name: check service runtime
    shell: ps -ef|grep java|grep {{ deploy_path }}|grep -v grep|awk '{print }'
    register: service_runtime

  - name: print service uptime
    debug: msg="Serivce {{ deploy_path }} last uptime is {{ service_runtime.stdout }}"