# Help to understand execution order

**URL:** <https://forum.ansible.com/t/help-to-understand-execution-order/18079>\
**Category:** Ansible Project\
**Created:** [April 24, 2015, 3:13pm UTC](https://forum.ansible.com/t/help-to-understand-execution-order/18079 "2015-04-24T15:13:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serega\_Sheypak](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Serega\_Sheypak](https://forum.ansible.com/u/Serega_Sheypak)\
**Post date:** [April 24, 2015, 3:13pm UTC](https://forum.ansible.com/t/help-to-understand-execution-order/18079/1 "2015-04-24T15:13:19Z")

</div>

Hi, i’m confused with execution order.

Here is a problem:

TASK: [common | installing oracle java] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [[ec2-52-17-234-176.eu-west-1.compute.amazonaws.com](http://ec2-52-17-234-176.eu-west-1.compute.amazonaws.com)]  
changed: [[ec2-52-17-201-78.eu-west-1.compute.amazonaws.com](http://ec2-52-17-201-78.eu-west-1.compute.amazonaws.com)]  
changed: [[ec2-52-17-234-141.eu-west-1.compute.amazonaws.com](http://ec2-52-17-234-141.eu-west-1.compute.amazonaws.com)]  
failed: [[ec2-52-17-199-200.eu-west-1.compute.amazonaws.com](http://ec2-52-17-199-200.eu-west-1.compute.amazonaws.com)] =\> {“changed”: true, “cmd”: “DEBIAN\_FRONTEND=noninteractive apt-get -y install oracle-java7-installer oracle-java7-set-default”, “delta”: “0:00:03.892655”, “end”: “2015-04-24 14:35:48.676917”, “rc”: 100, “start”: “2015-04-24 14:35:44.784262”}  
stderr: invoke-rc.d: initscript spark-worker, action “start” failed.  
dpkg: error processing package spark-worker (–configure):  
subprocess installed post-installation script returned error exit status 1  
Errors were encountered while processing:  
spark-worker  
E: Sub-process /usr/bin/dpkg returned an error code (1)

I don’t understand why task:

- name: installing oracle java  
shell: DEBIAN\_FRONTEND=noninteractive apt-get -y install oracle-java7-installer oracle-java7-set-default

triggers:  
stderr: invoke-rc.d: initscript spark-worker, action “start” failed.

how can I get the idea why it happens?

" installing oracle java" belongs to role common and spark-worker stuff is in other role executed after common role

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 24, 2015, 3:38pm UTC](https://forum.ansible.com/t/help-to-understand-execution-order/18079/2 "2015-04-24T15:38:38Z")

</div>

This is not an execution order issue, its a dpkg issue. Oracle's  
packages will prompt even when non interactive and dpkg allows for  
this ignoring your non interactive request. Use the debconf module to  
answer preemptively, i would also suggest using the apt module instead  
of calling apt from shell. I created a role that does this you can use  
(directly or as a guide) [https://galaxy.ansible.com/list#/roles/628](https://galaxy.ansible.com/list#/roles/628).

---

<div class="post-metadata">

**Author:** ![Serega\_Sheypak](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Serega\_Sheypak](https://forum.ansible.com/u/Serega_Sheypak)\
**Post date:** [April 24, 2015, 3:56pm UTC](https://forum.ansible.com/t/help-to-understand-execution-order/18079/3 "2015-04-24T15:56:39Z")

</div>

Thank you,  
replaced my bicycle with yours role, It works!
