ubuntu – clone a grafana setup to a different server

I’m writing a set of scripts to automatically setup any virgin ubuntu server to be in a state usable for my production environment.

One of the things I want to do is setup grafana so that, on install, it has already added prometheus as a datasource, has a dashboard setup, and any other configuration steps already done, without having to touch the graphical interface.

For that, I thought I could set up grafana in a development server, and save the entire configuration directories in gitlab, to copy that configuration into any new server.

Is this something that can be done? And, which directories should I save in version control to completely copy the local grafana setup?