Skip to content

How to get task id #2275

Answered by sebaboben
shb256 asked this question in Q&A
Aug 13, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

When running a playbook with the verbose tag I found this line:

extra_vars: ('{"semaphore_vars":{"task_details":{"id":308,"url":null,"username":"admin"}}}', 'rbose')

This shows some useful variables such as the task ID. So if you need to fetch it from it's respective playbook run you just need to use a task like this one.

- name: Fetch Task ID
  set_fact:
    taskid: "{{ semaphore_vars.task_details.id }}"

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@SirYaro
Comment options

@sebaboben
Comment options

Answer selected by fiftin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants