Writing a better deploy script
Shots from the hip, three decades since I seriously programmed shell notwithstanding:


document your code - in the code.
The comments presented are a good start - in the middle, irritatingly.
What is the whole script useful for, how shall it be used?
You can even have executable comments:
if called incorrectly or with -h, --help (or even -?), print a
Usage: to "standard error output"/file descriptor 2
Then there are things left open:
Why tee to es_passes.txt instead of redirect, have sed print the pattern space?  (I read Spanish_passes at first - the reason why in the following comment es may be as appropriate as elastic needed horizontal scrolling)
with security related artefacts, assess security implications
choose the right tool
this does not just depend on task at hand and tools available, but on "craftsperson", too
(Here, I might have chosen perl in the 90ies and Python in the current millenium century)
the options and commands to sed speak of GNU sed
• mention such in your question
• consider using --posix
don't use cat | command where command allows specifying input file(s)
prefer using awks patterns over separate filtering (e.g.,grep)
(unless input is massive):
awk '/PASSWORD kibana|elastic/{print $4}' es_passes.txt …
(not convinced piping to xargs -I is the way to proceed.)
the conventional "unix" way to eliminate duplicate lines is uniq, preceded with a sort where global uniqueness is necessary and altering line sequence admissible.