How to backup spaces and user,roles of elasticsearch

when i bounce elasticsearch and launch new application every time i need to create
user,roles,and spaces in elasticsearch .
i follow saved objects like dashboards using export ndjson file it is very helpful .
so like this ndjson file, any solution for backup user,roles,and spaces .

You can snapshot the system indices - eg .kibana or .security - and then restore them like any other index.