title: Mesos / Marathon Roles and Applications
body: <p>I want to run a Mesos/Marathon cluster with a mix of public and private apps.  It seems like it should be possible to leverage roles for this, but I'm not having success.</p>
  
  <p>As a proof-of-concept, I have a Mesos cluster with <code>public</code> and <code>private</code> roles:</p>
  
  <pre><code># curl --silent localhost:5050/roles | jq '.' | grep name
  "name": "*",
  "name": "public",
  "name": "private",
  </code></pre>
  
  <p>The problem arises with Marathon and my Marathon apps.  I'm unable to set <code>default_accepted_resource_roles</code> to a value that's different from <code>mesos_role</code>.  For example, if I set <code>--mesos_role=public</code> and <code>--default_accepted_resource_roles=public</code>, I'm able to run apps, but only if they include <code>"acceptedResourceRoles": [ "public" ]</code> in the application description.  Conversely, I can set everything to <code>private</code> and run private apps.  (Although, ironically, if I set everything to <code>*</code> I'm unable to run my apps.  I don't understand that at all.)</p>
  
  <p>Ideally, I'd like to run this way:</p>
  
  <pre><code>mesos_role=*
  default_accepted_resource_roles=private
  </code></pre>
  
  <p>I would expect this to give Marathon access to all my roles but start apps with the <code>private</code> role unless they specifically request the <code>public</code> role.  Unfortunately, this results in this error:</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: --default_accepted_resource_roles contains roles for which we will not receive offers: private
  </code></pre>
  
  <p>and Marathon refuses to start.</p>
  
  <p>Is it possible to run Marathon with <code>--mesos_role=*</code> and <code>--default_accepted_resource_roles=private</code>?  If not, I don't understand why the roles exist.  But I'd rather run as much as possible in a single cluster rather than spinning up separate clusters for public and private apps.</p>