Refactor: daemons: Create a do_pacemakerd_api_call function.
It looks like other pcmk_pacemakerd_api_* function calls will share an
awful lot of code with the existing ping function, so this might as well
get turned into a generic function that the task can be passed to.