Quick ansible script to update Java on many machines

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
    - name: Copy the java software
      copy: src=/app/jdk1.7.0_91 dest=/opt/java
      become: true
    - name: Move the softlink
        src: /opt/java/jdk1.7.0_91
        dest: /opt/java/jre
        state: link
      become: true

I 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.

Related Posts Plugin for WordPress, Blogger... 


How To Love Working from Home, Free from Distractions

Gamer Girls earning serious money