This week for one application I had many servers that needed to have their Java version updated and a softlink changed.
As there were so many involved, a nice simple Ansible playbook would sort this out.
All this does is copy the Java directory over to the machine, and create the softlink for jre. All I had to do then is list all the machines and run it. Just another basic example of some easy use cases for Ansible if you are starting to get into it.
The code is
--
- name: Copy Version of Java over for Xapp and create the link
hosts: newjava
user: root
tasks:
- name: Copy the java software
copy: src=/app/jdk1.7.0_91 dest=/opt/java
become: true
- name: Move the softlink
file:
src: /opt/java/jdk1.7.0_91
dest: /opt/java/jre
state: link
become: trueI am always interested in your thoughts so if you have any comments or feedback then please feel free to add any comments, or you can mail me here.
