Make the role slightly more configurable

Various unrelated changes to add more configurability. fe14efacc90b53e5b746b206eb331b99ae79fc87 is rather specific to our own use case. Cherry-pick the ones you deem useful.