Inclusion of recipe based on runtime condition

I'm trying to find a good way to include recipe based on runtime condition which requires PostgreSQL client installed for evaluation of this condition but I don't think this is possible.

Here's how it looks:

include_recipe "postgresql::install_client"

ruby_block 'find master node' do
    block do
        node.run_state['master'] = find_master_node(node['postgresql']['cluster']['name']) // runs PSQL client

  include_recipe "postgresql:new_slave" if node.run_state['master'] != node['fqdn'] // This obviously does not work

Open to other suggestions here.

I thought about putting postgresql::install_client in the run list first and then running this recipe with find_master_node in compilation phase and assigning result to variable but this does not work either.

I hate to put "only_if node.run_state['master'] != node['fqdn']" on each resource in postgresql:new_slave recipe and other recipes since this is not too maintainable but this seems to be the best Chef can do!?