Ansible_roles_check_mode = true using custom Job template


We’d like to use “ansible_roles_check_mode = true” with a custom Job template that runs a single role based on user input.

When we run the the below Job template the “ansible_roles_check_mode = true” parameter is being ignored.

Write now “ansible_roles_check_mode = true” is a global parameter but I’ve tried as hostgroup and host level too.

When using the default “Ansible Roles - Ansible Default” Job Template for all Ansible roles “ansible_roles_check_mode = true” works as expected.

Expected outcome:

Single Ansible role is ran against a remote host with “ansible_roles_check_mode = true” using custom Job template.

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:
Red Hat 7.9

Other relevant data:

This is our custom Job template that takes user input for the role name(s):

- hosts: all
    - name: Display all parameters known for the Foreman host
        var: foreman
        - always
    rolename: <%= input('rolename') %>

    - name: Apply Ansible Specific roles
        name: "{{ item }}"
        - always
      with_items: "{{ rolename }}"

AFAIK you can only use the check_mode if the callback plugin is enabled.
On Foreman 3.6 (foreman_ansible 11.0.0) we added a new feature that allows you to enable the callback plugin on any Ansible job template. You are using an old version where the callback plugin is only enabled for the default “Ansible Roles - Ansible Default” Job Template.

Ok thanks very much. That explains it :slight_smile: