How to tell if opendistro has been initialized

Hi, I’m trying to write ansible to install/configure the opendistro security plugin on top of elasticsearch. I’m using the opendistro_security/tools/ to initialize the plugin, but I understand that the shell script is not idempotent: I can’t run it without clobbering any user-defined roles and role-mappings. So, I need a way to determine whether the opendistro security plugin has been initialized.

Should I just call the shell script with the --show-info argument? When opendistro_security hasn’t yet been initialized, it fails with a stack trace and return code 255. I assume it will do otherwise when it’s been initialized. Is there a better way to do this?


It looks like the following works, which i like better than using the script:

http GET https://eshost:esport/.opendestro_security

and if it does not return an HTTP response of 200, assume opendistro hasn’t been initialized

That didn’t work either, becuz sometimes the http GET would return a 503 with the message, ‘OpenDistro not initialized’, and sometimes it would return a 404. It seems dangerous to assume that any/all 503’s are due to O.D. not being initialized.

So, instead, I just create a marker file when OD is initialized, and check for the existence of the marker file before initializing.