Skip to content

Instantly share code, notes, and snippets.

@jimbaker
Created September 15, 2016 16:18
Show Gist options
  • Select an option

  • Save jimbaker/028acb3a987ec254d1c3f634a5d562d8 to your computer and use it in GitHub Desktop.

Select an option

Save jimbaker/028acb3a987ec254d1c3f634a5d562d8 to your computer and use it in GitHub Desktop.
Description of the worker interaction

Workers are specialized as follows:

  • OpenStack Ansible, consuming that endpoint - we may want to assume Docker here
  • Generalized Docker-based commands, using docker-py to wrap

All workers have the following environment variables set:

  • CRATON_URL - URL for the Craton API endpoint
  • CRATON_TOKEN - time-limited, scoped token (inventory + keys) for working with the Craton service
  • CRATON_TASK - the specific task ID being run here to support lookup of the task details
  • CRATON_DEVICES - whitespace separated list of device IDs that the worker is responsible for (possibly empty)

Workers coordinate with the Craton service as follows:

.. seqdiag::

   seqdiag {
     service -> jobboard [label="setup tasks"];
     jobboard -> worker [label="run task using env vars"];
     worker -> service [label="get task config"];
     worker -> service [label="get ansible inventory on devices"];
     worker -> device [label="run playbook on devices"];
     device -> worker [label="results via callback API"];
     worker -> service [label="set variables in inventory"];
     worker -> jobboard [label="task completion"];
     jobboard -> worker [label="retry"];  # FIXME this needs to use the correct seq diag stuff here
   }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment