Hi,

I'm using Ansible to install Oracle and its been working great on 1.6. When 
I hit release 1.7 some things using the shell module started behaving 
differently.

The problem is this:

The oracle installer (runInstaller) is a shellscript that kicks off a java 
process (and puts the java process in the background) which then does the 
actual installation. Up until 1.7, Ansible waited for the job in the 
background to come back before moving on to the next task, but in 1.7 it 
just waits for the 'kickoff' script to come back and then moves on -> the 
play fails.

Now, I'm not sure if the old 1.6 behaviour is the way it should be or not, 
but I certainly hope so.

I've got a small test-case which mimics the behaviour I'm seeing exactly. 
(2 shell-scripts and a playbook). Gist is here 
<https://gist.github.com/oravirt/49dedc8c30baa43d9aaf>


kickoff.sh <- Starts another script (sleep.sh) and puts that in the 
background
sleep.sh <-- Does a few echo's with a sleep inbetween

 cat /tmp/kickoff.sh 
#!/bin/bash

echo "Kicking off other script at `date`"
sh /tmp/sleep.sh 30  &

echo "All finished. Returned from other script at `date`"




cat /tmp/sleep.sh 
#!/bin/bash

echo "Starting $0 at `date`"
echo "Sleeping $1 seconds"
sleep $1

echo "$0 Woke up"
echo "Sleeping another $1 seconds"
sleep $1

echo "$0 Done. Exiting $0 at `date`"



The playbook (background.yml):
---
- hosts: localhost
  connection: local
  gather_facts: false
  tasks:

  - name: run shellscript
    shell: /tmp/kickoff.sh
    register: sleep

  - debug: var=sleep.stdout_lines

*Output from 1.6*

[miksan@ponderstibbons ansible]$ ansible --version
ansible 1.6.10
[miksan@ponderstibbons ansible]$ time ansible-playbook background.yml

PLAY [localhost] 
************************************************************** 

TASK: [run shellscript] 
******************************************************* 
changed: [localhost]

TASK: [debug var=sleep.stdout_lines] 
****************************************** 
ok: [localhost] => {
    "sleep.stdout_lines": [
        "Kicking off other script at Thu Sep 25 10:54:38 CEST 2014", 
        "All finished. Returned from other script at Thu Sep 25 10:54:38 
CEST 2014", # <--- Exits the kickoff script, but it waits for sleep.sh to 
finish
        "Starting /tmp/sleep.sh at Thu Sep 25 10:54:38 CEST 2014",  # <--- 
sleep.sh starts in the background
        "Sleeping 30 seconds", 
        "/tmp/sleep.sh Woke up", 
        "Sleeping another 30 seconds", 
        "/tmp/sleep.sh Done. Exiting /tmp/sleep.sh at Thu Sep 25 10:55:38 
CEST 2014" # <--- sleep.sh finishes
    ]
}

PLAY RECAP 
******************************************************************** 
localhost                  : ok=2    changed=1    unreachable=0    failed=0 
  


*real    1m0.288s*
user    0m0.147s
sys     0m0.039s
[miksan@ponderstibbons ansible]$



*Output from 1.7*

[miksan@ponderstibbons ansible]$ ansible --version
ansible 1.7.2
[miksan@ponderstibbons ansible]$ time ansible-playbook background.yml

PLAY [localhost] 
************************************************************** 

TASK: [run shellscript] 
******************************************************* 
changed: [localhost]

TASK: [debug var=sleep.stdout_lines] 
****************************************** 
ok: [localhost] => {
    "sleep.stdout_lines": [
        "Kicking off other script at Thu Sep 25 10:45:15 CEST 2014", 
        "All finished. Returned from other script at Thu Sep 25 10:45:15 
CEST 2014",  # <--- Exists kickoff.sh, doesnt wait for sleep.sh to finish 
        "Starting /tmp/sleep.sh at Thu Sep 25 10:45:15 CEST 2014", # <--- 
sleep.sh starts, but never gets to finish
        "Sleeping 30 seconds"
    ]
}

PLAY RECAP 
******************************************************************** 
localhost                  : ok=2    changed=1    unreachable=0    failed=0 
  


*real    0m1.291s*
user    0m0.148s
sys     0m0.034s



So, is this a bug or how should I approach this?

regards
/Micke






-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ccdf0c2f-d3f5-4252-b586-5d8874b5260b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to