# Bumping the version of a library and deleting older versions

**URL:** <https://forum.ansible.com/t/bumping-the-version-of-a-library-and-deleting-older-versions/14213>\
**Category:** Ansible Project\
**Created:** [December 24, 2013, 11:55am UTC](https://forum.ansible.com/t/bumping-the-version-of-a-library-and-deleting-older-versions/14213 "2013-12-24T11:55:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gary\_Malouf](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@Gary\_Malouf](https://forum.ansible.com/u/Gary_Malouf)\
**Post date:** [December 24, 2013, 11:55am UTC](https://forum.ansible.com/t/bumping-the-version-of-a-library-and-deleting-older-versions/14213/1 "2013-12-24T11:55:32Z")

</div>

I have a jar file named something like myjar -1.1.0-assembly.jar. When our team does a release, a new jar named something like myjar -1.2.0-assembly.jar is created and needs to be deployed to the world. Additionally, any jars matching the myjar -[VERSION]-assembly.jar pattern need to be deleted as part of this process to prevent any class conflicts at runtime.

What’s the best way to do this with Ansible?

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [December 24, 2013, 12:31pm UTC](https://forum.ansible.com/t/bumping-the-version-of-a-library-and-deleting-older-versions/14213/2 "2013-12-24T12:31:29Z")

</div>

Package them and let your distribution’s package manager handle that?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [December 24, 2013, 3:14pm UTC](https://forum.ansible.com/t/bumping-the-version-of-a-library-and-deleting-older-versions/14213/3 "2013-12-24T15:14:30Z")

</div>

packaging is better, but a quick and dirty play:

- shell: ls myjar -\*-assembly.jar  
&nbsp;&nbsp;register: existingjars

- copy: newjar dest=  
&nbsp;&nbsp;&nbsp;register: jarchanged

# or this can also be a handler, change register:jarchanged to notify  
- file: path={{item}} state=absent  
&nbsp;&nbsp;&nbsp;with\_items: existingjars  
&nbsp;&nbsp;&nbsp;when: jarchanged.changed
