Foreman 3.11 & DEB11 -NOT all single role running on multiple servers are correctly done with different results

Problem:
Not running role on all selected servers

Expected outcome:
fix or workaround ( not one by one )

Foreman and Proxy versions:
foreman 3.11.2-1+debian11
foreman-proxy 3.11.2-1+debian11

Foreman and Proxy plugin versions:

ruby-foreman-ansible                           14.0.0-1
ruby-foreman-bootdisk                         21.2.3-1
ruby-foreman-deface                            1.9.0-2
ruby-foreman-dhcp-browser                 0.0.8-2
ruby-foreman-discovery                       24.0.1-1
ruby-foreman-fog-proxmox                   0.15.1-1
ruby-foreman-maintain                         1.6.7-1+debian11
ruby-foreman-monitoring                      3.1.0-1~fm3.11
ruby-foreman-puppet                            7.0.0-1~fm3.11
ruby-foreman-remote-execution           13.1.0-1
ruby-foreman-rescue                             4.0.1-1
ruby-foreman-snapshot-management   3.0.1-1
ruby-foreman-tasks                               9.1.1-1
ruby-foreman-templates                        9.4.0-2
ruby-hammer-cli-foreman                      3.11.0-1+debian11
ruby-hammer-cli-foreman-ansible          0.7.0-1+debian11
ruby-hammer-cli-foreman-discovery      1.3.0-1+debian11
ruby-hammer-cli-foreman-puppet          0.1.0-1+debian11
ruby-hammer-cli-foreman-remote-execution    0.3.0-1+debian11
ruby-hammer-cli-foreman-ssh                 0.0.3
ruby-hammer-cli-foreman-tasks               0.0.21-1+debian11
ruby-hammer-cli-foreman-templates        0.3.0-1+debian11

Distribution and version:
Debian 11

Other relevant data:
When running single role over multiple servers selected explicitly from “hosts all” menu or are selected from selected group, then correctly running only first one. Rest of all have two execute possibilities :
= the first one is that role is missing

   1: /var/tmp/foreman-ssh-cmd-9aa19d04-3492-48b3-a4c2-8db061be2d6f/script: 1: system-ansible-user: not found
   2: Exit status: 127
   3: StandardError: Job execution failed

= the second one is that all looks OK, but nothing happened

   1: ansible-playbook 2.10.17
   2:  config file = None
   3:  configured module search path = ['/usr/share/foreman-proxy/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
   4:  ansible python module location = /usr/lib/python3/dist-packages/ansible
   5:  executable location = /usr/bin/ansible-playbook
   6:  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
   7: No config file found; using defaults
   8: Skipping callback 'awx_display', as we already have a stdout callback.
   9: Skipping callback 'default', as we already have a stdout callback.
  10: Skipping callback 'minimal', as we already have a stdout callback.
  11: Skipping callback 'oneline', as we already have a stdout callback.
  12:
  13: PLAYBOOK: playbook.yml *********************************************************
  14: 1 plays in playbook.yml
  15:
  16: PLAY [Run Ansible Role system-ansible-user] ************************************
  17:
  18: TASK [Gathering Facts] *********************************************************
  19: task path: /tmp/d20240917-3752-oe2twi/project/playbook.yml:2
  20: META: ran handlers
  21:
  22: TASK [system-ansible-user : add ansible group] *********************************
  23: task path: /etc/ansible/roles/system-ansible-user/tasks/main.yml:4
  24:
  25: TASK [system-ansible-user : add ansible user] **********************************
  26: task path: /etc/ansible/roles/system-ansible-user/tasks/main.yml:11
  27: 
  28: TASK [system-ansible-user : add ssh key] ***************************************
  29: task path: /etc/ansible/roles/system-ansible-user/tasks/main.yml:24
  30:
  31: TASK [system-ansible-user : Ensure ansible user has passwordless sudo access] ***
  32: task path: /etc/ansible/roles/system-ansible-user/tasks/main.yml:34
  33: META: ran handlers
  34: META: ran handlers
  35: PLAY RECAP *********************************************************************
  36: Exit status: 0

The problem occurres on any single role which I’m running ( system-ansible-user is only an example )
If I continue with servers where role in OK status, then role works fine with expected results, but if “role missing” on server, I have to go to server directly and run single role via menu ( upper right ), then the role running fine.

Conclusion
NOT all single role running on multiple servers are correctly done with different results

more info

plugin develop version
foreman-tasks Ivan Nečas 9.1.1
foreman_ansible Dominic Cleal 21.2.3
foreman_dhcp_browser Ohad Levy 0.0.8
foreman_discovery Tristan Robert and The Foreman Team 0.15.1
foreman_monitoring Timo Goebel 3.1.0
foreman_puppet Ondřej Ezr and Shira Maximov 7.0.0
foreman_remote_execution Foreman Remote Execution team 13.1.0
foreman_rescue Timo Goebel 4.0.1
foreman_snapshot_management ATIX AG 3.0.1
foreman_templates Greg Sutcliffe 9.4.0

F I X E D

Main problem was in job template which takes care of the running of role.

“OLD version” - with wrong funkcionality

---
- name: "Run Ansible Role <%= input('role_name') %>"
  hosts: "<%= @host.name %>"
  roles:
    - role: "<%= input('role_name') %>"

“NEW version” - with requested funkcionallity

---
- name: "Run Ansible Role <%= input('role_name') %>"
  hosts: all
  roles:
    - role: "<%= input('role_name') %>"

Very trivial solution, but who can find it

the small note:

hosts: all

this option doesn’t mean that role running over all registered nodes, but only current selection in this case