Switch to ternary for nginx cookbook logic

In order to simplify the code used to set the http_realip_module, this
commit switches it to a ternary and avoids duplicating the log and
shovel statements.

[24882]