Refactor get_nodes and set_facts into a single role