Job actions

Launch, abort, relaunch, approve or reject, and delete a job

  1. Launch a job
    1. Who can launch a form
    2. Before you submit
    3. Choices at launch time
    4. What can stop a launch
    5. Other ways to start a job
  2. Abort a job
  3. Relaunch a job
    1. Relaunch on the failed hosts
    2. Relaunch from the failed node
    3. Relaunch with pre-filled data
  4. Approve or reject a job
  5. Delete a job

Launch a job

Every job starts from a form. Open it from the Forms page, fill in the fields and press Submit:

  1. The form is validated in the browser, and the field values are posted to the server.
  2. The server creates the job and returns its number; the form’s onSubmit actions run.
  3. The job’s output appears under the form and refreshes every two seconds until the job ends.

The job also appears on the Jobs page, where you can follow it later.

Who can launch a form

A form is listed, and can be launched, for users who have one of the roles in its roles list. The default role, which every user has, makes a form available to everyone who can sign in.

Before you submit

The bar above the fields offers a few tools, each shown only when your role allows it:

Button What it does Role option
Show extravars Previews the extravars the job will receive, as you fill in the fields showExtraVars
verbose Runs the job in verbose mode allowVerboseMode
Load from store Fills the fields from a stored job allowStoredJobs
Reload this form Loads the form again, with its default values none

Choices at launch time

A form can let its users pick some Ansible options when they launch it, by declaring a field with a reserved name. The value of the field then overrides the form’s own setting:

Field name Overrides Typical field type
__check__ Check mode, a dry run that changes nothing checkbox
__diff__ Diff mode, which shows what would change checkbox
__limit__ The hosts the playbook runs on text or enum
__tags__ The tags to run text or enum
__inventory__ The inventory enum
__playbook__, __template__ The playbook, or the AWX / AAP template enum

For example, a form that offers a dry run and a host limit:

fields:
  - name: __check__
    type: checkbox
    label: Dry run (check mode)
  - name: __limit__
    type: text
    label: Limit to these hosts

The server only accepts these names from a form that declares them as fields, so a launch from the API cannot add them on its own. The properties they override are described with Ansible forms and AWX forms.

What can stop a launch

A launch does not always become a running job straight away:

  • Invalid fields : the form is not submitted, and each field that fails its validation shows why.
  • Launch validation : with launch validation set to enforce, the server checks the values again and refuses a launch that breaks the form’s rules.
  • Approval : a form with an approval point creates the job, which then waits in status approve; see Approve or reject a job.

When the job ends, the form’s notifications send their mails and channel messages, and its job status actions run.

Other ways to start a job

A form can also start a job without a person pressing Submit:

Started by How Page
Run later or a cron schedule Run later (one-time) or Schedule (recurring) next to Submit Schedules
A script or a pipeline POST /api/v2/job with an API token REST API jobs
An AI agent The MCP server’s launch_job tool MCP tools
A conversation The chat assistant fills in the form and launches it Chat assistant
An earlier job Relaunch, below Relaunch a job

Abort a job

Abort in the row’s menu (⋮) of the list, or Abort job on the job’s page, stops a job with status running. After you confirm, AnsibleForms marks the job for abort:

  • ansible: the RTE stops the playbook process (with all its workers), and the job ends as aborted with ... was aborted by the operator. A job still waiting for a free RTE is aborted before it starts.
  • A template job (AWX, AAP, Ascender, Semaphore, Rundeck, Jenkins): AnsibleForms asks the runner to cancel or stop the job, and the job ends as aborted. When the runner refuses, the output shows Abort request denied, followed by reverting abort request, and the job keeps running. A Jenkins build still in the queue is taken out of it.
  • workflow: the running node jobs are aborted and nothing more starts (see Running a workflow).
  • multistep: the steps that have not started yet are skipped (skipping: [Abort is requested]), and the main job ends as aborted. A step that is already running is a job of its own: open it and abort it to stop it as well.

You can abort your own jobs; an admin, or from 7.3.0 a user whose role sets manageAllJobs, can abort any job. showAllJobLogs lets a user see other users’ jobs, not abort them.


Relaunch a job

Relaunch in the row’s menu (⋮) of the list, or Relaunch job on the job’s page, starts a new job from a finished one. It is offered on any job that is neither running nor waiting for approval, to users whose role sets the allowJobRelaunch role option.

On the job’s page, Relaunch job is a plain button, or a split button with a caret, like the form’s Submit, when the job offers a second choice: on its failed hosts or from its failed node. Its main part is always the full relaunch, and the list’s row menu offers the full relaunch only.

The dialog offers:

  • Relaunch: runs the job again with the values it ran with, as a new job under your name.
  • Verbose mode: relaunches in verbose mode; shown with the allowVerboseMode role option.
  • Edit values before relaunching, then Edit & relaunch: opens the form pre-filled with the job’s values, so you can change them before you submit.

A relaunch also requires the form to allow it (allowRelaunch, true by default) and the job to be your own, unless you are an admin or, from 7.3.0, have manageAllJobs; showAllJobLogs, which relaunched any job up to 7.2, no longer does. How a relaunch is checked against the form’s rules, and why a form with a password field may refuse it, is described in Relaunching.

Relaunch on the failed hosts

From 7.7.0 a job that failed on some of its hosts can run again on those hosts only, leaving the others alone.

The caret of Relaunch job then offers On all hosts, the full relaunch, and On failed hosts (N), with N the hosts that failed a task or could not be reached. It is offered on an ended job of these kinds:

Job Its failed hosts come from The re-run
A playbook on an RTE The recap of its events, else the PLAY RECAP of its output A new job, limited to those hosts
A job template on AWX, AAP or Ascender The job’s host summaries on that runner The product’s own relaunch on failed hosts, on the runner the job ran on

A job that ran on one host, or failed on every host, keeps the plain button: a re-run of its failed hosts would be the full relaunch. A failure that ignore_errors let pass, or that a rescue handled, does not count. Jenkins, Semaphore and Rundeck jobs, workflow and multistep jobs, and the node jobs of a workflow are not re-run on their failed hosts.

The re-run is a new job with the same values as the job it comes from:

  • Hosts: the failed hosts only, within the job’s own limit; a re-run of a re-run stays within the hosts of the one before.
  • Checks: the same approval, launch validation and permissions as the full relaunch.
  • Dialog: it lists the hosts before you confirm, without Edit values before relaunching.
  • Job page: re-run of #N, with failed hosts beside it, links to the job; a playbook’s Hosts fact lists the hosts.
  • Output: it starts with a line such as ok: [Re-run of job 42 on its 2 failed host(s): web07, web19].

A failed host whose name Ansible would read as a pattern, with a *, a ~ or a [ for example, is left out of the re-run, and the output says so in a [WARNING] line. On the RTE the hosts reach ansible-playbook as a limit file, one host per line, so a host name with a comma or a colon stays one host.

Relaunch from the failed node

From 7.7.0 a failed workflow job can run again from the node that failed, keeping what the nodes before it did.

The caret of Relaunch job then offers From the first node, the full relaunch, and From the failed node. Which workflow jobs offer it:

Workflow job From the failed node
An AnsibleForms workflow The nodes that succeeded are carried over, and the run starts at the failed node(s)
An Ascender workflow job Ascender’s own relaunch of the failed nodes, on the runner the job ran on
An AWX or AAP workflow job Not offered: the full relaunch only
A multistep job (deprecated) Not offered: the full relaunch only

The new job goes through the same approval, launch validation and permissions as the full relaunch, and its page shows re-run of #N with failed node beside it. When an AnsibleForms workflow offers it, and what is carried over, is described in Running a workflow.

Relaunch with pre-filled data

Edit & relaunch opens the form with the prefillJobId URL parameter, which you can also use in a link of your own:

https://af.example.com/form?form=New%20Virtual%20Machine&prefillJobId=61

The form loads the field values stored with job 61 and shows Form pre-filled with data from previous job #61. Submitting it starts a new job, checked like any other launch. The pre-fill follows the same rules as a relaunch:

  • Password fields are never stored, so they are never pre-filled: enter them again. Constants are not stored either.
  • The allowJobRelaunch role option is required, and the job must be your own (or you are an admin or have manageAllJobs).
  • A form with allowRelaunch: false cannot be relaunched or pre-filled:
- name: New Virtual Machine
  type: ansible
  playbook: create-vm.yaml
  allowRelaunch: false

A job from before the field values were stored cannot be pre-filled, and the form shows an error instead:

No saved form data found for job <id>. This job may have been created before the relaunch feature was enabled.

Approve or reject a job

A job with an approval point stops in status approve and waits. It is listed on the Jobs page of its approvers, the users with one of the approval’s roles, so they can find it; from 7.3.0 other users no longer see it.

Review approval is offered to admins and to users who have one of the approval’s roles: a click on the job’s row, Review approval in the row menu, or the Review approval button on the job’s page. The dialog shows the approval’s message, with the job’s values filled in (or a generic line without one), and the form, the job id, who launched it and when, with a link to the job; Reject and Approve answer it:

  • Approve: the job continues and its status returns to running.
  • Reject: the job ends as rejected, and its output records rejected by <username>.

A job waiting for approval cannot be relaunched or deleted from the Jobs page; approve or reject it first.

From 7.3.0 the user who launched a job cannot approve it, so a second person always looks at it, though they can still reject it to withdraw it. An admin can always approve, their own jobs included. A form whose approval point sets allowSelf: true lets its launcher approve their own job too.


Delete a job

Delete in the row’s menu (⋮) of the list, or Delete job on the job’s page, deletes a job with its output after you confirm. Deleting a multistep job deletes its steps too. To delete several jobs at once, tick them in the list’s first column and click Delete (n) above it.

You can delete your own jobs. Admins and, from 7.3.0, users with the manageAllJobs role option can delete any job; showAllJobLogs no longer can. A role that sets allowJobDeletion: false deletes no job at all, not even its own, so the job history stays whole. On the job’s page the button is hidden while the job is running or aborting (except for admins and manageAllJobs) and while it waits for approval; in the list, the menu entry and the checkbox are greyed out for a job you cannot delete.