Hi,
I’m using Ansible to install Oracle and it’s been working great on 1.6, but when I hit 1.7 some of the tasks using the shell module started behaving differently, specifically with jobs in the background.
The oracle installer (runInstaller) is a shell script that kicks off a java process (and puts it in the background) which then performs the actual installation. In 1.6 the play waited for the background job to finish before moving on to the next task, but from 1.7 it just waits for the ‘kickoff’ script to come back and then moves on → the play fails.
I’m not sure if the old behaviour is the correct one, but I certainly hope so.
I’'ve got a small testcase which exactly mimics the behaviour I’m seeing. Gist is here (2 shellscripts & a playbook)
kickoff.sh : Starts another script (sleep.sh) in the background
sleep.sh: Does a few echo’s with a sleep inbetween
1.6 behaviour
`
[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”, # <— kickoff.sh finishes, but 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
`
1.7 behaviour
`
[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”, # <— kickoff.sh finishes but doesnt wait for sleep.sh to finish
“Starting /tmp/sleep.sh at Thu Sep 25 10:45:15 CEST 2014”, # <— sleep.sh starts (in the background) 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
`
Is this a bug in 1.7 (or 1.6)? How should I approach this?
regards
/Micke