#4286·semaphore

Problem: task_params nested under `params` (the shape the Terraform provider sends) is silently ignored, so --skip-tags/--tags/--limit never reach ansible-playbook

Author: vectis-labs-archieCreated Sep 26, 2026Updated Sep 26, 2026

Semaphore: 2.19.12 (binary/systemd on Debian) · Ansible: core 2.19.11 on the control node, 2.21.3 in CI

Issue

AnsibleTemplateParams declares its fields at the JSON top level:

go
type AnsibleTemplateParams struct {
	Limit    []string `json:"limit"`
	Tags     []string `json:"tags"`
	SkipTags []string `json:"skip_tags"`
	...
}

Template.FillParams marshals the stored task_params object and unmarshals it into that struct. The API stores the object you send verbatim, with no normalisation. So a nested task_params — {"params":{"skip_tags":[...]}} — unmarshals to an empty AnsibleTemplateParams, skipTags stays "", and local_executor.go never appends the flag:

go
if skipTags != "" {
	templateArgs = append(templateArgs, "--skip-tags="+skipTags)
}

No error, no log line. The template runs with the parameter silently ignored.

Why this bites provider users

The Terraform provider's own model nests. semaphoreui/models/task_prams.go:

go
Params struct {
	AnsibleTaskParams
	TerraformTaskParams
} `json:"params,omitempty"`

and internal/provider/task_params_schema.go exposes task_params.ansible.*, so convertTaskParamsModelToTaskPrams sends {"params":{"skip_tags":[...]}}. Every provider-managed template therefore has a skip_tags that never applies.

Hit in production: a nightly playbook with skip_tags = ["offloaded"] executed the offloaded play every night until it failed the run.

The WebUI writes task_params.skip_tags flat (TemplateForm.vue: this.item.task_params.skip_tags = tags), so the bug is invisible to UI users and only surfaces in provider-managed projects.

Reproduction

Create two templates on the same playbook, differing only in shape:

A: task_params = {"skip_tags": ["x"]}                # flat
B: task_params = {"params": {"skip_tags": ["x"]}}    # nested (provider shape)

Start a task from each. To make the flag's presence visible in the run shape, set tags to a value matching no task, so a present flag must skip everything:

template run output
flat PLAY header, then straight to PLAY RECAP; every task skipped
nested TASK executes; ok: on every host; the flag was dropped

--skip-tags cannot be observed this way, since skipping a task that would be skipped anyway is a no-op, but it is read from the same skipTags variable as --tags.

Suggested fix

Normalise the shape once, at one of the two boundaries:

  • have FillParams accept both shapes — if the object has a params key, unmarshal that first and fall back to the flat object; or
  • normalise task_params on write, so {"params":{...}} and {"ansible":{...}} both land flat.

The provider also accepts task_params.ansible.*, producing a third shape ({"ansible":{...}}) with the same effect. Any fix should cover it.

FillParams is unchanged on develop as of this report.