Roles and Permission creation programatically inside module
Create the roles on your development site and grab the configuration for them and place them in:

&lt;modulename&gt;/config/install 


When the module is installed it will import that configuration. hook_install is deprecated for installing configuration with a module.

Remove any uuid information from the export as it won't be applicable in most sites.

If you are unaware how to export/import configuration in drupal 8, you should read:
D8 Configuration Management

edit: Just as an aside fact, you can in theory write your own config.yml files however until you are very familiar it's easier to just create the role, and export it.