How to get the administrator role id to assign new permissions?
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);