# configure/make best practices?

**URL:** <https://forum.ansible.com/t/configure-make-best-practices/14978>\
**Category:** Ansible Project\
**Created:** [April 9, 2014, 2:38pm UTC](https://forum.ansible.com/t/configure-make-best-practices/14978 "2014-04-09T14:38:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Levitt](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@Jason\_Levitt](https://forum.ansible.com/u/Jason_Levitt)\
**Post date:** [April 9, 2014, 2:38pm UTC](https://forum.ansible.com/t/configure-make-best-practices/14978/1 "2014-04-09T14:38:42Z")

</div>

What’s the Ansible best practice for doing a typical source compile of multiple packages?

So, let’s say you have three source packages that all require the same  
three steps: configure, make, and make install.

The three packages have all have been untar-ed into their own directories:

/var/tmp/pkg1  
/var/tmp/pkg2  
/var/tmp/pkg3

What’s the typical Ansible way to handle it?

- name: build sources

command: chdir=/var/tmp/{{ item }} sudo .configure --prefix=/usr

command: chdir=/var/tmp/{{ item }} sudo make

command: chdir=/var/tmp/{{ item }} sudo make install

with\_items:

- pkg1

- pkg2

- pkg3

---

<div class="post-metadata">

**Author:** ![Jason\_Levitt](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@Jason\_Levitt](https://forum.ansible.com/u/Jason_Levitt)\
**Post date:** [April 14, 2014, 1:20pm UTC](https://forum.ansible.com/t/configure-make-best-practices/14978/2 "2014-04-14T13:20:51Z")

</div>

I guess I’ll answer my own question. This seems to be the most common approach:

- name: build ffmpeg

command: chdir=/var/tmp/ffmpeg-0.11 {{ item }}

with\_items:

- sudo ./configure --enable-libmp3lame

- sudo make

- sudo make install PATH=$PATH:/usr/local/bin

If you need env variables set for a specific step, you can add them on the

command line as I’ve done with the PATH above. The PATH is changed only for

the ‘sudo’ (e.g. root) environment.

J

---

<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:** [April 15, 2014, 9:52am UTC](https://forum.ansible.com/t/configure-make-best-practices/14978/3 "2014-04-15T09:52:14Z")

</div>

Not a direct answer, but I can strongly recommend making your own packages  
for this sort of situation. It's make those tasks idempotent and scales a lot  
better if you can leverage your underlying package manager.

Building debs/rpms is a massive pain, I know - have a look at FPM  
( [https://github.com/jordansissel/fpm](https://github.com/jordansissel/fpm) )  
if you need something to make it really easy.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 15, 2014, 9:32pm UTC](https://forum.ansible.com/t/configure-make-best-practices/14978/4 "2014-04-15T21:32:58Z")

</div>

Yep, I’d designate one machine a build server and build packages there, then make a local apt or yum repository.

This is pretty easy either way you go.
