[root@jenkins ansible]# cat java.yaml - hosts: newserver tasks: - name : java lineinfile : dest=/etc/profile regexp="^JAVA_HOME=" line="JAVA_HOME=/usr/local/jdk" - name : java lineinfile : dest=/etc/profile regexp="^CLASS_PATH=" line="CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib" - name : java lineinfile : dest=/etc/profile regexp="^PATH=\$PATH:\$JAVA_HOME" line="PATH=$PATH:$JAVA_HOME/bin" - name : java lineinfile : dest=/etc/profile regexp="^export JAVA_HOME" line="export JAVA_HOME" - name : java copy : src=/app/LKOS/www/jdk-7u80-ea-bin-b03-linux-x64-19_nov_2014.tar.gz dest=/tmp/jdk.tgz - name : java file : path=/usr/local/jdk state=absent - name : java shell : cd /tmp && tar zxf jdk.tgz && mv jdk1.7.0_80 /usr/local/jdk
本文出自 “天道酬勤” 博客,请务必保留此出处http://lavenliu.blog.51cto.com/5060944/1714803
原文地址:http://lavenliu.blog.51cto.com/5060944/1714803