[TriLUG] init script behaves different when invoked from Ansible playbook??

Phillip Rhodes (Fogbeam Labs) via TriLUG trilug at trilug.org
Thu May 11 13:06:28 EDT 2017


On Thu, May 11, 2017 at 1:01 PM, Brian Gerard via TriLUG <trilug at trilug.org>
wrote:

> When you say it dies in the middle, is there a particular point at which
> it dies every time?  Ie - you added a bunch of debugging echoes in there;
> can you say what it's trying to do when it dies?  If not, I'd recommend
> adding more and appending to a log in /tmp or something to see if you can
> pinpoint where it's failing.
>

Yes, it always fails dies (or hangs, I just realized it might still be
running) at the same place.  It's trying to do this business:

SCRIPTPATH=$(dirname "$0")




>
> FWIW, the first thing that popped into my brain was the possibility that
> Ansible might have mucked about with the shell syntax, if you're handling
> that script as a "template" rather than a "file", but since it seems to
> work from outside of Ansible, I'm less sure of that.  It might be worth
> looking at anyway, just to check.  Diffing the source script and the
> installed
> version, iow.
>

Oh yeah, that's a good thought.  I was thinking in terms of "I'm not
explicitly doing any
substitution stuff in here" and was treating the template as equivalent to
a static file.  That
is probably a bad idea, even if it isn't directly the cause of my problem
here.


I'm trying it again now with the script spitting out $BASHPID at the
beginning to (hopefully) I can determine if maybe it's hung, as opposed to
the process having aborted.


Phil


More information about the TriLUG mailing list