500 Internal Server Error when importing Ansible roles

I am trying to import my ansible roles into a new install of Foreman. The ansible roles are pre-existing, working roles. Here is the output of foreman-rake errors:fetch_log request_id=b76fa1b5.

Foreman version: 3.11.2
Plugins:
 - foreman-tasks 9.1.1
 - foreman_ansible 14.0.0
 - foreman_remote_execution 13.1.0
 - katello 4.13.1

2024-09-23T15:38:45 [I|app|b76fa1b5] Started GET "/ansible/ansible_roles/import?proxy=1-gp2us1opsfm01-main02a-tdsops-net" for 10.254.0.3 at 2024-09-23 15:38:45 +0000
2024-09-23T15:38:45 [I|app|b76fa1b5] Processing by AnsibleRolesController#import as HTML
2024-09-23T15:38:45 [I|app|b76fa1b5]   Parameters: {"proxy"=>"1-gp2us1opsfm01-main02a-tdsops-net"}
2024-09-23T15:38:46 [W|app|b76fa1b5] 500 Internal Server Error
2024-09-23T15:38:46 [I|app|b76fa1b5] Backtrace for '500 Internal Server Error' error (RestClient::InternalServerError): 500 Internal Server Error
 b76fa1b5 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:249:in `exception_with_response'
 b76fa1b5 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:129:in `return!'
 b76fa1b5 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:836:in `process_result'
 b76fa1b5 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:743:in `block in transmit'
 b76fa1b5 | /usr/share/ruby/net/http.rb:960:in `start'
 b76fa1b5 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:727:in `transmit'
 b76fa1b5 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:163:in `execute'
 b76fa1b5 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:63:in `execute'
 b76fa1b5 | /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/resource.rb:51:in `get'
 b76fa1b5 | /usr/share/foreman/app/services/proxy_api/resource.rb:81:in `block (2 levels) in get'
 b76fa1b5 | /usr/share/foreman/app/services/foreman/telemetry_helper.rb:28:in `telemetry_duration_histogram'
 b76fa1b5 | /usr/share/foreman/app/services/proxy_api/resource.rb:78:in `block in get'
 b76fa1b5 | /usr/share/foreman/app/services/proxy_api/resource.rb:121:in `with_logger'
 b76fa1b5 | /usr/share/foreman/app/services/proxy_api/resource.rb:77:in `get'
 b76fa1b5 | /usr/share/gems/gems/foreman_ansible-14.0.0/app/lib/proxy_api/ansible.rb:31:in `all_variables'
 b76fa1b5 | /usr/share/gems/gems/foreman_ansible-14.0.0/app/services/foreman_ansible/variables_importer.rb:150:in `remote_variables'
 b76fa1b5 | /usr/share/gems/gems/foreman_ansible-14.0.0/app/services/foreman_ansible/variables_importer.rb:25:in `import_variable_names'
 b76fa1b5 | /usr/share/gems/gems/foreman_ansible-14.0.0/app/helpers/foreman_ansible/ansible_roles_data_preparations.rb:80:in `block in prepare_ansible_import_rows'
 b76fa1b5 | /usr/share/gems/gems/foreman_ansible-14.0.0/app/helpers/foreman_ansible/ansible_roles_data_preparations.rb:79:in `each'
 b76fa1b5 | /usr/share/gems/gems/foreman_ansible-14.0.0/app/helpers/foreman_ansible/ansible_roles_data_preparations.rb:79:in `prepare_ansible_import_rows'
 b76fa1b5 | /usr/share/gems/gems/foreman_ansible-14.0.0/app/controllers/ansible_roles_controller.rb:25:in `import'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/base.rb:228:in `process_action'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/rendering.rb:30:in `process_action'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 b76fa1b5 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 b76fa1b5 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 b76fa1b5 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 b76fa1b5 | /usr/share/gems/gems/audited-5.6.0/lib/audited/sweeper.rb:16:in `around'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 b76fa1b5 | /usr/share/gems/gems/audited-5.6.0/lib/audited/sweeper.rb:16:in `around'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:137:in `run_callbacks'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:41:in `process_action'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/rescue.rb:22:in `process_action'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:203:in `block in instrument'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:203:in `instrument'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 b76fa1b5 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/base.rb:165:in `process'
 b76fa1b5 | /usr/share/gems/gems/actionview-6.1.7.8/lib/action_view/rendering.rb:39:in `process'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb:190:in `dispatch'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb:254:in `dispatch'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:32:in `each'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:32:in `serve'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:842:in `call'
 b76fa1b5 | /usr/share/gems/gems/katello-4.13.1/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
 b76fa1b5 | /usr/share/gems/gems/katello-4.13.1/lib/katello/middleware/event_daemon.rb:10:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 b76fa1b5 | /usr/share/gems/gems/apipie-dsl-2.6.2/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 b76fa1b5 | /usr/share/gems/gems/apipie-rails-1.3.0/lib/apipie/static_dispatcher.rb:74:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 b76fa1b5 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 b76fa1b5 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 b76fa1b5 | /usr/share/gems/gems/apipie-rails-1.3.0/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/tempfile_reaper.rb:15:in `call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/etag.rb:27:in `call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/conditional_get.rb:27:in `call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/head.rb:12:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
 b76fa1b5 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/session/abstract/id.rb:266:in `context'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/session/abstract/id.rb:260:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/cookies.rb:697:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:98:in `run_callbacks'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 b76fa1b5 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/rack/logger.rb:37:in `call_app'
 b76fa1b5 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/rack/logger.rb:28:in `call'
 b76fa1b5 | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 b76fa1b5 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 b76fa1b5 | /usr/share/gems/gems/katello-4.13.1/lib/katello/prevent_json_parsing.rb:12:in `call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/method_override.rb:24:in `call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/runtime.rb:22:in `call'
 b76fa1b5 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/executor.rb:14:in `call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/sendfile.rb:110:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 b76fa1b5 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
 b76fa1b5 | /usr/share/gems/gems/secure_headers-6.5.0/lib/secure_headers/middleware.rb:11:in `call'
 b76fa1b5 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/engine.rb:539:in `call'
 b76fa1b5 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/railtie.rb:207:in `public_send'
 b76fa1b5 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/railtie.rb:207:in `method_missing'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:74:in `block in call'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:58:in `each'
 b76fa1b5 | /usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:58:in `call'
 b76fa1b5 | /usr/share/gems/gems/puma-6.4.2/lib/puma/configuration.rb:272:in `call'
 b76fa1b5 | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:100:in `block in handle_request'
 b76fa1b5 | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
 b76fa1b5 | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:99:in `handle_request'
 b76fa1b5 | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:464:in `process_client'
 b76fa1b5 | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:245:in `block in run'
 b76fa1b5 | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
 b76fa1b5 | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2024-09-23T15:38:46 [I|app|b76fa1b5]   Rendered common/500.html.erb within layouts/application (Duration: 1.2ms | Allocations: 899)
2024-09-23T15:38:46 [I|app|b76fa1b5]   Rendered layouts/base.html.erb (Duration: 2.1ms | Allocations: 1945)
2024-09-23T15:38:46 [I|app|b76fa1b5]   Rendered layout layouts/application.html.erb (Duration: 3.7ms | Allocations: 3117)
2024-09-23T15:38:46 [I|app|b76fa1b5] Completed 500 Internal Server Error in 165ms (Views: 4.4ms | ActiveRecord: 7.8ms | Allocations: 23594)ype or paste code here

Figured it out. I needed to set up ansible in the collections design. Then it worked.

1 Like