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 & ~