Skip to content

Instantly share code, notes, and snippets.

@dmsimard
Created November 19, 2022 23:40
Show Gist options
  • Save dmsimard/9a4c443ff69709cfb8b40ad31e21afd5 to your computer and use it in GitHub Desktop.
Save dmsimard/9a4c443ff69709cfb8b40ad31e21afd5 to your computer and use it in GitHub Desktop.
ara internal workflow
Foreground
(synchronous, blocking) ┌─► v2_playbook_on_task_start
│ v2_runner_on_ok
│ - wait for previous task pool (if any) v2_runner_on_unreachable ┌─► v2_playbook_on_stats
┌─► __init__ ┌─► v2_playbook_on_start │ - initialize task thread pool v2_runner_on_failed │
│ │ ┌─► v2_playbook_on_play_start │ - self.client.post("/api/v1/files") ┌─► v2_runner_on_skipped │ - wait for task threads
│ - Set options │ - initialize global thread pool │ │ (to create the task file, if necessary) │ │ - wait for global threads
│ - Set config │ - self.client.post("/api/v1/playbook") │ - self.client.post("/api/v1/play") │ - self.client.post("/api/v1/tasks") │ - Sends result & status to self._load_result │ - self.client.patch("/api/v1/playbooks")
┌──────────────┐ │ - Get API client │ (to create a playbook) │ (to create a play) │ (to create a task, if necessary) │ inside a task thread and returns │ (to set playbook status and end date)
│ │ │ │ │ │ │ │
│ ansible-core ├──┴───────────────────┴┬────────────────────────────────────────┴─────────────────────────────────────┴────────────────────────────────────────────┴┬──────────────────────────────────────────────┘
│ │ │ │
└──────────────┘ │ │ "Task" threads
│ ▼ (background, non-blocking)
│ ┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ │ │
│ │ ──► self._load_result │
│ │ │
│ │ - self.client.post("/api/v1/hosts") │
│ │ (to create the host to associate the result to, if necessary) │
│ │ - self.client.post("/api/v1/results") │
│ │ (to create the result with the result, host, task and content) │
│ │ - self.client.patch("/api/v1/hosts") │
│ │ (if the task gathered host facts) │
│ │ │
│ "Global" threads └─────────────────────────────────────────────────────────────────────────────────────────────┘
▼ (background, non-blocking)
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ │
│ │ ┌─► v2_playbook_on_play_start │
│ │ │ │
│ ├─► v2_playbook_on_start │ - self.client.patch("/api/v1/plays") ┌─► v2_playbook_on_stats │
│ │ │ (to close previous play, if any) │ │
│ │ - self.client.post("/api/v1/files") │ - self.client.patch("/api/v1/playbooks") │ - self.client.patch("/api/v1/hosts") │
│ │ (to create files) │ (to set playbook labels) │ (to set task stats provided by ansible) │
│ │ │ │ │
│ └──────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment