How to get the administrator role id to assign new permissions? In my module I'm creating new permissions that I want by default also assigned to the Drupal admin user. 

I know how to assign new permissions to a role, but I don't know how to get the Drupal administrator role id. In the database the rid for administrator is 3, but can I rely on that being always the case? I'm using Drupal 7.
unless you install Drupal in your custom installation profile and modify the administrator role there, the rid or administrator will be always 3.
Or you could just do a db_query() on role table to return the rid of administrator as:  

$result = db_query("SELECT rid FROM {role} where name like :id",array(':id' =&gt; 'administrator'));
$admin_rid = $result-&gt;fetchField(0);