jenkins ansible

 

 

ansible-playbook

- hosts: test
  remote_user: root
  vars:
    warpath: "/root/.jenkins/workspace/172.16.230.168/target/senyint-weixin-0.0.1-SNAPSHOT.war"
    codepath: "/data/code/"
    tomcat: "/data/tomcat/"
  tasks:
    - name: rm  /data/code/
      #file: path={{codepath}} state=absent
      shell: rm -rf /data/code/*
    - name: copy war to IDC_dest
      copy: src={{ warpath }} dest={{ codepath }}
    - name:  kill java
      shell: /data/tomcat/bin/shutdown.sh
    - name: 删除/data/webserver/目录
      shell: rm -rf /data/webserver/*
    - name: uzip war -d /data/webserver/
      shell: /usr/bin/unzip {{codepath}}senyint-weixin-0.0.1-SNAPSHOT.war -d /data/webserver/
    - name: start java
      shell: chdir={{tomcat}}bin/ nohup ./startup.sh &
~                                                                

 

posted @ 2017-10-30 10:42  fengjian1585  阅读(270)  评论(0编辑  收藏  举报