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

Phillip Rhodes via TriLUG trilug at trilug.org
Thu May 11 12:14:45 EDT 2017


Gang:

I've run into something which has me stumped.  I have an ansible
playbook which is meant to automate the installation of a project
called existdb.  To that end, I have an 'existdb' init script as a
template in the playbook, and I copy it into /etc/init.d and then
later run "service existdb start".

The /etc/init.d/existdb script in turn calls another script (which I
didn't write).  So here's the weird part.  When I run the ansible
playbook, the service doesn't start.  I've added "echo 1", "echo 2"
type lines throughout the second shell script to verify that it's
called, and it is, but it just mysteriously dies in the middle.   But,
if I ssh into the box, 'sudo su -'  to become root, and then run
"service existdb start" it all works fine.

This feels like some kind of environment issue, but I am stumped on
what it could be.  I would think that invoking an init script using
the "service" command would be identical regardless of whether it's
done by root logged in locally, or using sudo and ssh remotely.   Is
there something obvious I should be looking for, that is likely to be
different between those two scenarios?

FWIW, I stuck a call to 'env' in the second script and it appears that
everything reported by env is identical whether it's done from ansible
or done locally.   I'm not a shell guru, so I'm not really sure how to
debug this.   If anybody has any ideas, they would be greatly
appreciated.


Phil
~~~


This message optimized for indexing by NSA PRISM


More information about the TriLUG mailing list