# Collectd - manual install from source - only if a new package is not available

**URL:** <https://forum.ansible.com/t/collectd-manual-install-from-source-only-if-a-new-package-is-not-available/17675>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [March 5, 2015, 10:40am UTC](https://forum.ansible.com/t/collectd-manual-install-from-source-only-if-a-new-package-is-not-available/17675 "2015-03-05T10:40:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tzach\_Livyatan1](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@Tzach\_Livyatan1](https://forum.ansible.com/u/Tzach_Livyatan1)\
**Post date:** [March 5, 2015, 10:40am UTC](https://forum.ansible.com/t/collectd-manual-install-from-source-only-if-a-new-package-is-not-available/17675/1 "2015-03-05T10:40:41Z")

</div>

Hello  
I have a role for installing Collectd agent.

To get the Riemann plugin, I need version 5.4.0 or above.  
The following works fine on Ubuntu 14.x

`

- apt: pkg={{ item }} state=present update\_cache=yes cache\_valid\_time=600  
with\_items:
- collectd=5.4.0

`

But, Ubuntu 12.x does not have the latest collectd, so I’m using a manual process:

`

- name: Download Collectd  
`  
get\_url: url={{collectd\_url}}{{collectd\_version}}.tar.gz dest=“/home/{{login\_user}}/”  
register: new\_archive

- name: Unarchive source  
unarchive:  
src=“/home/{{login\_user}}/{{collectd\_version}}.tar.gz”  
dest=“/home/{{login\_user}}/”  
copy=no  
when: new\_archive|changed

- name: confgiure  
shell: ./configure  
args:  
chdir: /home/{{login\_user}}/{{collectd\_version}}

- name: make  
sudo: yes  
shell: make all install  
args:  
chdir: /home/{{login\_user}}/{{collectd\_version}}

So my question:  
How to keeping using the apt-get when 5.4.0 is available and install from source when its not?

Thanks

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [March 5, 2015, 4:08pm UTC](https://forum.ansible.com/t/collectd-manual-install-from-source-only-if-a-new-package-is-not-available/17675/2 "2015-03-05T16:08:00Z")

</div>

Do yourself a favour and build a Deb with FPM, it's pretty straightforward.
