Ansible playbook reports: undefined method `[]' for nil:NilClass

Problem:
Some of the ansible playbook reports throws Oops, we're sorry but something went wrong undefined method '[]' for nil:NilClass

Actually some of the playbook reports is working but some of them are not, as I’ve less experienced with ansible/foreman. My guess is that, some of the tasks status are not known (or) not printed in the console (even with any number of verbose mode ) i.e success/failure/changed, etc. Please refer the ansible execution log which is causing me problem in last section of this issue.

Expected outcome:
Able to see Ansible playbook execution’s reports.

Foreman and Proxy versions:

vagrant@foreman-01:/tmp/ansible$ sudo apt list foreman* --installed
Listing... Done
foreman-cli/focal,focal,now 3.3.0-1 all [installed]
foreman-debug/focal,focal,now 3.3.0-1 all [installed,automatic]
foreman-dynflow-sidekiq/focal,focal,now 3.3.0-1 all [installed]
foreman-installer/focal,focal,now 3.3.0-1 all [installed]
foreman-libvirt/focal,focal,now 3.3.0-1 all [installed]
foreman-postgresql/focal,focal,now 3.3.0-1 all [installed]
foreman-proxy/focal,focal,now 3.3.0-1 all [installed,automatic]
foreman-service/focal,focal,now 3.3.0-1 all [installed]
foreman/focal,now 3.3.0-1 amd64 [installed,automatic]

Foreman and Proxy plugin versions:

foreman-tasks: 6.1.0
foreman_ansible: 7.1.0
foreman_puppet: 4.0.1
foreman_remote_execution: 7.1.0

Distribution and version:

Distribution: Debian/Ubuntu
OS Version: Ubuntu 20.04.4 LTS

vagrant@foreman-01:/tmp/ansible$ hostnamectl status
   Static hostname: foreman-01.ta.local
         Icon name: computer-vm
           Chassis: vm
        Machine ID: ee8af9ab964d44698439f4cda5cc43ff
           Boot ID: 2624d3fc4c5b47e8bd6428dec99fcc45
    Virtualization: kvm
  Operating System: Ubuntu 20.04.4 LTS
            Kernel: Linux 5.4.0-121-generic
      Architecture: x86-64
vagrant@foreman-01:/tmp/ansible$ 
vagrant@foreman-01:/tmp/ansible$ 
vagrant@foreman-01:/tmp/ansible$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Other relevant data:

I don’t find any other helpful logs in /var/log/foreman/production.log & /var/lib/foreman-proxy/*.log. Below find the logs for the errors:fetch_log (Hats off to foreman team to have this implementation which is really nice & handy)

Execution: foreman-rake errors:fetch_log request_id=1bf3840f
vagrant@foreman-01:/tmp/ansible$ sudo foreman-rake errors:fetch_log request_id=1bf3840f 
2022-07-04T18:33:35 [I|app|1bf3840f] Started GET "/config_reports/19" for 192.168.29.201 at 2022-07-04 18:33:35 +0000
2022-07-04T18:33:35 [I|app|1bf3840f] Processing by ConfigReportsController#show as HTML
2022-07-04T18:33:35 [I|app|1bf3840f]   Parameters: {"id"=>"19"}
2022-07-04T18:33:35 [I|app|1bf3840f]   Rendering config_reports/show.html.erb within layouts/application
2022-07-04T18:33:35 [I|app|1bf3840f]   Rendered vendor/ruby/2.7.0/gems/foreman_ansible-7.1.0/app/views/foreman_ansible/config_reports/_ansible.html.erb (Duration: 18.4ms | Allocations: 6143)
2022-07-04T18:33:35 [I|app|1bf3840f]   Rendered config_reports/show.html.erb within layouts/application (Duration: 30.4ms | Allocations: 8001)
2022-07-04T18:33:35 [W|app|1bf3840f] undefined method `[]' for nil:NilClass
2022-07-04T18:33:35 [I|app|1bf3840f] Backtrace for 'undefined method `[]' for nil:NilClass' error (ActionView::Template::Error): undefined method `[]' for nil:NilClass
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_ansible-7.1.0/app/helpers/foreman_ansible/ansible_reports_helper.rb:35:in `ansible_module_message'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_ansible-7.1.0/app/views/foreman_ansible/config_reports/_ansible.html.erb:24:in `block in _vendor_ruby_______gems_foreman_ansible_______app_views_foreman_ansible_config_reports__ansible_html_erb__1443736663603104426_289760'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.4.8/lib/active_record/relation/delegation.rb:88:in `each'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.4.8/lib/active_record/relation/delegation.rb:88:in `each'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_ansible-7.1.0/app/views/foreman_ansible/config_reports/_ansible.html.erb:18:in `_vendor_ruby_______gems_foreman_ansible_______app_views_foreman_ansible_config_reports__ansible_html_erb__1443736663603104426_289760'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/base.rb:274:in `_run'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/template.rb:185:in `block in render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications.rb:182:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/template.rb:385:in `instrument_render_template'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/template.rb:183:in `render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/partial_renderer.rb:357:in `block in render_partial'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications.rb:180:in `block in instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications.rb:180:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/partial_renderer.rb:346:in `render_partial'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/partial_renderer.rb:317:in `render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/renderer.rb:65:in `render_partial_to_object'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/renderer.rb:53:in `render_partial'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/helpers/rendering_helper.rb:38:in `render'
 1bf3840f | /usr/share/foreman/app/views/config_reports/show.html.erb:15:in `_app_views_config_reports_show_html_erb__4280081101784676292_289740'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/base.rb:274:in `_run'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/template.rb:185:in `block in render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications.rb:182:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/template.rb:385:in `instrument_render_template'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/template.rb:183:in `render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/template_renderer.rb:58:in `block (2 levels) in render_template'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications.rb:180:in `block in instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications.rb:180:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/template_renderer.rb:57:in `block in render_template'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/template_renderer.rb:65:in `render_with_layout'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/template_renderer.rb:56:in `render_template'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/template_renderer.rb:13:in `render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/renderer/renderer.rb:29:in `render_to_object'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/rendering.rb:117:in `block in _render_template'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/base.rb:304:in `in_rendering_context'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/rendering.rb:116:in `_render_template'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/streaming.rb:218:in `_render_template'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/rendering.rb:103:in `render_to_body'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/abstract_controller/rendering.rb:25:in `render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/rendering.rb:36:in `render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
 1bf3840f | /usr/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/core_ext/benchmark.rb:14:in `ms'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.4.8/lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/instrumentation.rb:43:in `render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/implicit_render.rb:35:in `default_render'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/basic_implicit_render.rb:6:in `block in send_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/basic_implicit_render.rb:6:in `tap'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/abstract_controller/base.rb:195:in `process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/rendering.rb:30:in `process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
 1bf3840f | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 1bf3840f | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 1bf3840f | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/callbacks.rb:139:in `run_callbacks'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/abstract_controller/callbacks.rb:41:in `process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/rescue.rb:22:in `process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications.rb:180:in `block in instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/notifications.rb:180:in `instrument'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.4.8/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/abstract_controller/base.rb:136:in `process'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.0.4.8/lib/action_view/rendering.rb:39:in `process'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal.rb:190:in `dispatch'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_controller/metal.rb:254:in `dispatch'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/journey/router.rb:49:in `block in serve'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/journey/router.rb:32:in `each'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/journey/router.rb:32:in `serve'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/routing/route_set.rb:834:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-dsl-2.5.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-rails-0.5.20/lib/apipie/static_dispatcher.rb:66:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-rails-0.5.20/lib/apipie/extractor/recorder.rb:137:in `call'
 1bf3840f | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 1bf3840f | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-rails-0.5.20/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/tempfile_reaper.rb:15:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/etag.rb:27:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/conditional_get.rb:27:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/head.rb:12:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
 1bf3840f | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/session/abstract/id.rb:266:in `context'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/session/abstract/id.rb:260:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/cookies.rb:654:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/callbacks.rb:101:in `run_callbacks'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.0.4.8/lib/rails/rack/logger.rb:37:in `call_app'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.0.4.8/lib/rails/rack/logger.rb:28:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 1bf3840f | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/request_id.rb:27:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/method_override.rb:24:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/runtime.rb:22:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.0.4.8/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/executor.rb:14:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/static.rb:126:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/sendfile.rb:110:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/ssl.rb:74:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.0.4.8/lib/action_dispatch/middleware/host_authorization.rb:97:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/secure_headers-6.3.3/lib/secure_headers/middleware.rb:11:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.0.4.8/lib/rails/engine.rb:527:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.0.4.8/lib/rails/railtie.rb:190:in `public_send'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.0.4.8/lib/rails/railtie.rb:190:in `method_missing'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/urlmap.rb:74:in `block in call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/urlmap.rb:58:in `each'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.3.1/lib/rack/urlmap.rb:58:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.4/lib/puma/configuration.rb:252:in `call'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.4/lib/puma/request.rb:77:in `block in handle_request'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.4/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.4/lib/puma/request.rb:76:in `handle_request'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.4/lib/puma/server.rb:441:in `process_client'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.4/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
 1bf3840f | /usr/share/foreman/vendor/ruby/2.7.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2022-07-04T18:33:35 [I|app|1bf3840f]   Rendering common/500.html.erb within layouts/application
2022-07-04T18:33:35 [I|app|1bf3840f]   Rendered common/500.html.erb within layouts/application (Duration: 2.3ms | Allocations: 549)
2022-07-04T18:33:35 [I|app|1bf3840f]   Rendered layouts/_application_content.html.erb (Duration: 0.4ms | Allocations: 64)
2022-07-04T18:33:35 [I|app|1bf3840f]   Rendering layouts/base.html.erb
2022-07-04T18:33:35 [I|app|1bf3840f]   Rendered layouts/base.html.erb (Duration: 5.3ms | Allocations: 2232)
2022-07-04T18:33:35 [I|app|1bf3840f] Completed 500 Internal Server Error in 107ms (Views: 9.8ms | ActiveRecord: 15.0ms | Allocations: 21269)

Foreman version: 3.3.0
Plugins:

  • foreman-tasks 6.0.2
  • foreman_ansible 7.1.0
  • foreman_puppet 4.0.1
  • foreman_remote_execution 7.1.0

Ansible version: ansible [core 2.12.7]
Ansible playbook, I’ve used is mostly invocations of roles from debops.debops with very minimal tweaks. Roles I’ve used are,

  1. monit
  2. logrotate
  3. sshd
  4. redis

Details about destination host/machine where the ansible-playbook executed:
OS: Ubuntu 18.04

Details provided here are my local test environment using libvirt. I am facing similar issues with my production environment as well, which I can’t share details here.

Production foreman version is 3.1.3

Is somebody else facing the same issue ? i am not able to find a solution yet. Any help is much appreciated!!

Hi, did you figure this one out? I am seeing the exact same issue.

I Have not found any solutions yet. Are you using ansible role
debops/debops ?

BTW, I’ve also created an issue in debops/debops.

Thanks for the reply.

No, I am not using debops/debops roles. We use custom roles that provide a similar function.

I see the “undefined method” when role vas are assigned with a hash parameter type.

I don’t see any issues with the config_report when a string or array parameter type is used.

The roles execute on the remote node in all tests. It’s just the config report that’s broken for hashes.

This looks like a ruby issue where we have a missing object that’s not being passed to the report, so the lookup fails. I don’t know how to troubleshoot this any further.

I’ll check the status of your github Issue for updates.

Thanks,

Thanks for the report!

I was able to reproduce @fidal1990’s problem, opened Bug #35883: undefined method `[]’ for nil:NilClass when rendering reports with no_log: true - Ansible - Foreman to track it and proposed a patch in Fixes #35883 - don't fail if data is missing due to no_log by evgeni · Pull Request #580 · theforeman/foreman_ansible · GitHub

@Oleg_Mcnoleg not sure you’re seeing exact the same issue. Could you please provide logs and some more info about your Ansible role and data?

1 Like

Hi evgeni,

Thanks for the reply. You are correct, I am seeing a different issue to the one described in this thread.

Specifically we are hitting this bug:

Bug #35885: Bug 2155392 - Host config report page raises “undefined method `[]’ for nil:NilClass” error - Ansible - Foreman (theforeman.org)

Thank you both for you responses. At this stage I’m happy that my issue will be resolved via the above bug. So no further action needed at this stage.

1 Like