[[email protected] 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
时间: 2024-10-29 19:05:44