Can role be picked from yml and user from API

Logically speaking, an Elasticsearch cluster is a thing to manage. It is made up of nodes that also need to be managed, but there are many things that you might want to manage as a "thing" in a cluster not per-node.

Roles are one such thing, but so are index templates, scripts and cluster settings.

Even if you put roles into a per-node file, you will eventually run into problems that cannot be solved by simply treating a cluster as a series of nodes. You will need to find a way to use puppet (or if necessary some other tool) to manage a cluster.