Raj B
Raj B

Reputation: 1

How to upgrade the existing software/tools installed using Ansible

I have requirement to upgrade existing tools/software installed on servers (used for DevOps Agentpool) using Ansible. Can anyone share sample YAML code and steps involved to upgrade. Tools to upgrade like Java 11 to 18, Git, Maven etc.

Upvotes: 0

Views: 1347

Answers (2)

Brandon DeYoung
Brandon DeYoung

Reputation: 45

This kind of question probably should include the OS of the target. Assuming you're running rpm/yum based linux, something like this would work:

   - name: update java 8
     yum: 
       name: 
         - java-1.8.0-openjdk-headless
         - java-1.8.0-openjdk
         - java-1.8.0-openjdk-devel
       state: latest

Upvotes: 0

malpanez
malpanez

Reputation: 290

Basically the up mentioned code:

- name: update java 8
  package:
   name:
     - java-1.8.0-openjdk-headless
     - java-1.8.0-openjdk
     - java-1.8.0-openjdk-devel
   state: latest

What really does is install the latest version of the package for those in the list which implies the upgrade of it or replacement of the old with the new one.

Disclaimer: this is code is provided as it is. Not necessarily will resolve your problem.

If you want a better answer, probably need to provide more information or give a better example of what you want to do or your intention.

Upvotes: 1

Related Questions