标签:host div bubuko 分享 playbook shell amp remote pid
1 --- 2 - hosts: web-server 3 remote_user: root 4 tasks: 5 - name: stop logstash 6 shell: PID=`ps -ef | grep logstash | grep -v grep | awk ‘{print $2}‘`; if [ $PID ];then kill -9 $PID && echo "rm ok";fi 7 - name: rm old logstash 8 shell: rm -rf /data1/elk/logstash* 9 - name: cp new logstash 10 copy: src=/home/dev/playbook/conf.zip dest=/data1/elk/conf.zip 11 - name: unzip 12 shell: /usr/bin/unzip -o /data1/elk/conf.zip -d /data1/elk/logstash-6.5.1/ 13 - name: cp new logstash 14 copy: src=/home/dev/playbook/conf.zip dest=/data1/elk/conf.zip 15 - name: unzip 16 shell: /usr/bin/unzip -o /data1/elk/conf.zip -d /data1/elk/logstash-6.5.1/
标签:host div bubuko 分享 playbook shell amp remote pid
原文地址:https://www.cnblogs.com/abkn/p/10120689.html