How do I add role permissions to custom module
Create a file my_module.permissions.yml and add

my permission:
  title: 'This is my custom permission'
  description: 'A custom permission for your.'


Then use your permission in your my_module.routing.yml:

example.name:
  path: '/example/{name}'
  defaults:
    _controller: '\Drupal\example\Controller\ExampleController::content'
  requirements:
    _permission: 'my permission'


Now you can configure your custom permission on admin/people/permissions