# Compiling some source with Ansible

**URL:** <https://forum.ansible.com/t/compiling-some-source-with-ansible/11493>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [May 3, 2012, 10:17am UTC](https://forum.ansible.com/t/compiling-some-source-with-ansible/11493 "2012-05-03T10:17:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harm\_Aarts](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Harm\_Aarts](https://forum.ansible.com/u/Harm_Aarts)\
**Post date:** [May 3, 2012, 10:17am UTC](https://forum.ansible.com/t/compiling-some-source-with-ansible/11493/1 "2012-05-03T10:17:01Z")

</div>

Dear list,

Our servers run Ubuntu 10.04. We’d like to run the latest Monit on it. This needs to be compiled from source. A snippet:

- name: move Monit source  
action: copy src=monit-5.3.2.tar.gz dest=/tmp/monit-5.3.2.tar.gz
- name: untar the source  
action: command tar xzf /tmp/monit-5.3.2.tar.gz
- name: build the source  
action: command cd /home/vagrant/monit-5.3.2 && make && make install

Evidently the last one doesn’t work. Using the ‘shell’ module seems unsafe so I was thinking of making the last action into three actions (still seems not quite right). One ‘cd’, two ‘make’, three ‘make install’. But even the first action fails with:  
failed: [localhost] =\> command cd /home/my\_user/monit-5.3.2 =\> {“cmd”: [“cd”, “/home/my\_user/monit-5.3.2”], “failed”: 1, “msg”: “[Errno 2] No such file or directory”}

I checked, the directory is there. What am I doing wrong? Or better yet how should I do this?

With kind regards,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 3, 2012, 11:58am UTC](https://forum.ansible.com/t/compiling-some-source-with-ansible/11493/2 "2012-05-03T11:58:15Z")

</div>

> Dear list,
> 
> Our servers run Ubuntu 10.04. We’d like to run the latest Monit on it. This needs to be compiled from source. A snippet:
> 
> - name: move Monit source  
> action: copy src=monit-5.3.2.tar.gz dest=/tmp/monit-5.3.2.tar.gz
> - name: untar the source  
> action: command tar xzf /tmp/monit-5.3.2.tar.gz
> - name: build the source  
> action: command cd /home/vagrant/monit-5.3.2 && make && make install
> 
> Evidently the last one doesn’t work. Using the ‘shell’ module seems unsafe so I was thinking of making the last action into three actions (still seems not quite right). One ‘cd’, two ‘make’, three ‘make install’. But even the first action fails with:  
> failed: [localhost] =\> command cd /home/my\_user/monit-5.3.2 =\> {“cmd”: [“cd”, “/home/my\_user/monit-5.3.2”], “failed”: 1, “msg”: “[Errno 2] No such file or directory”}
> 
> I checked, the directory is there. What am I doing wrong? Or better yet how should I do this?

Let me change the question. Building modules on the remote server is not a good configuration management practice – You want to build a package and then install it.

If you don’t want to use the shell module, you can always execute multiple things using with\_items. See the playbook docs!
