change fab function to return the nodes dict and write to file if required

Updated createResourceYaml function in fab to return the nodes dict rather than return 0 on success.
This dict will be used to configure fab itself (to define role defs).
Also made yaml file write conditional - only write to file if file_path is set.