configure/make best practices?

1,199 views
Skip to first unread message

Slim Slam

unread,
Apr 9, 2014, 10:38:42 AM4/9/14
to ansible...@googlegroups.com
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

Slim Slam

unread,
Apr 14, 2014, 9:20:51 AM4/14/14
to ansible...@googlegroups.com
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

Dick Davies

unread,
Apr 15, 2014, 5:52:14 AM4/15/14
to ansible...@googlegroups.com
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 )
if you need something to make it really easy.
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5e70d78d-287b-44a1-96e3-1674f9e3f411%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Michael DeHaan

unread,
Apr 15, 2014, 5:32:58 PM4/15/14
to ansible...@googlegroups.com
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.



Reply all
Reply to author
Forward
0 new messages