Quick confirmation re: foreman_ansible v2.3.0

Can anyone confirm if foreman_ansible Release 2.3.0 has added support for configuring variables in the UI?

Yes it did, though this release is only available in nightly repos. Also thereā€™s no easy way to set those variables per host, once you import variables, you need to override them in their edit form and set the matcher yourself.

1 Like

Thanks for the confirmation @Marek_Hulan!
A few follow up questions:

  • Can I safely install just this package from the nightly repos?
  • Whatā€™s the recommended way to rollback if I run into any issues? Can I just reinstall the previous version?
  • How long before itā€™s available in the other repos? (considering just waiting)
  • In regards to your second statement, would that mean thereā€™s just no link to configure the role params from the hostā€™s information page, however, I should still be able to set the matcher here to something like the fqdn to assign a value:

(i.e. a little inconvenient, but functional)

Very happy to see the addition of this feature! I can get rid of my host_vars/group_vars directories on the filesystem. :slight_smile:

Depends on which version youā€™re on. On 1.20 itā€™ll probably work but 1.19 and older use a different ruby version so will not work.

1 Like

Hi ekohl,

Can you post a link to the nightly repo where foreman_ansible v2.3.0 is listed please. I checked https://yum.theforeman.org/plugins/nightly/ and https://yum.theforeman.org/nightly/el7/x86_64/ and did not see it listed.

Thank you.

Ouch sorry for misleading you, the package has not yet been built, it got stuck on packaging side [1]. Weā€™ll need to check what happened there. To answer your questions.

  1. yes, it should be generally compatible with 1.20, Iā€™d recommend back up DB since once you install it, new SQL tables will be created, if you want to later rollback, itā€™s better to restore DB backup, also youā€™ll need to update your smart_proxy_ansible plugin and potentially some dependencies
  2. rollback usually means install older version of package and restoring the DB (also httpd service restart, the same for smart proxy)
  3. if we get users like you reporting it works we can just push to 1.20, so your findings would make it much faster
  4. exactly

[1] https://github.com/theforeman/foreman-packaging/pull/3225

2 Likes

Actually no, it wonā€™t work because of webpack. We need to rebuild for 1.20. The easiest way is to open a packaging PR against rpm/1.20 and use the built RPM from there. We donā€™t have to merge it just yet.

1 Like

Thanks that info. Thatā€™s very helpful!

Thanks! I know how to do a PR, however, Iā€™m a little unsure about what a packaging PR should contain? Can you point me in the right direction? Do I need to modify a reference in the v1.20 code so it specifies v2.3.0 for foreman_ansible?

This should get a koji link attached which should then have links to RPMs for 1.20.

1 Like

@paulcalabro were you able to download and install the rpm? If yes, did it work with 1.20? Please let us know once you have a chance to test.

Hi Marek,

I had some to try the rpm on my centOS 7 build running1.20. The Ansible Variable option is now listed but I am seeing an error when I try to import variable.

Here is the output to the production log:

2018-12-04T11:59:31 [I|app|] Started GET "/ansible/ansible_variables/import?proxy=1-ansible01-localdomain-net" for 192.168.56.1 at 2018-12-04 11:59:31 -0500
2018-12-04T11:59:31 [I|app|54d8e] Processing by AnsibleVariablesController#import as HTML
2018-12-04T11:59:31 [I|app|54d8e]   Parameters: {"proxy"=>"1-ansible01-localdomain-net"}
2018-12-04T11:59:31 [I|app|54d8e] Current user set to admin (admin)
2018-12-04T11:59:31 [W|app|54d8e] ProxyAPI operation FAILED
ProxyAPI::ProxyException: ERF12-0319 [ProxyAPI::ProxyException]: Unable to get roles/variables from Ansible ([RestClient::NotFound]: 404 Not Found) for proxy https://ansible01.localdomain.net:8443/ansible/
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-2.3.0/app/lib/proxy_api/ansible.rb:33:in `rescue in all_variables'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-2.3.0/app/lib/proxy_api/ansible.rb:30:in `all_variables'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-2.3.0/app/services/foreman_ansible/variables_importer.rb:97:in `remote_variables'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-2.3.0/app/services/foreman_ansible/variables_importer.rb:14:in `import_variable_names'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-2.3.0/app/controllers/ansible_variables_controller.rb:24:in `import'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.9/lib/apipie/static_dispatcher.rb:65:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.9/lib/apipie/extractor/recorder.rb:136:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/usr/share/foreman/lib/middleware/telemetry.rb:9:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.9/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
/usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/tempfile_reaper.rb:15:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/conditional_get.rb:25:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/head.rb:12:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/usr/share/foreman/lib/middleware/logging_context.rb:23:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.0.0/lib/secure_headers/middleware.rb:13:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call'
/usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
/usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
/usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
/usr/share/passenger/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
/opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2018-12-04T11:59:31 [I|app|54d8e] Redirected to https://192.168.56.102/ansible/ansible_variables
2018-12-04T11:59:31 [I|app|54d8e] Completed 302 Found in 201ms (ActiveRecord: 11.4ms)
2018-12-04T11:59:31 [I|app|] Started GET "/ansible/ansible_variables" for 192.168.56.1 at 2018-12-04 11:59:31 -0500
2018-12-04T11:59:31 [I|app|b04de] Processing by AnsibleVariablesController#index as HTML
2018-12-04T11:59:31 [I|app|b04de] Current user set to admin (admin)
2018-12-04T11:59:31 [I|app|b04de]   Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-2.3.0/app/views/ansible_variables/index.html.erb within layouts/application
2018-12-04T11:59:31 [I|app|b04de]   Rendering text template
2018-12-04T11:59:31 [I|app|b04de]   Rendered text template (0.0ms)
2018-12-04T11:59:31 [I|app|b04de]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-2.3.0/app/views/ansible_variables/index.html.erb within layouts/application (9.5ms)
2018-12-04T11:59:31 [I|app|b04de]   Rendered layouts/_application_content.html.erb (0.6ms)
2018-12-04T11:59:31 [I|app|b04de]   Rendering layouts/base.html.erb
2018-12-04T11:59:31 [I|app|b04de]   Rendered layouts/base.html.erb (29.0ms)
2018-12-04T11:59:31 [I|app|b04de] Completed 200 OK in 60ms (Views: 38.7ms | ActiveRecord: 5.5ms)
2018-12-04T11:59:34 [I|app|] Started GET "/notification_recipients" for 192.168.56.102 at 2018-12-04 11:59:34 -0500
2018-12-04T11:59:34 [I|app|90946] Processing by NotificationRecipientsController#index as JSON
2018-12-04T11:59:34 [I|app|90946] Current user set to admin (admin)
2018-12-04T11:59:34 [I|app|90946] Completed 200 OK in 10ms (Views: 0.2ms | ActiveRecord: 1.3ms)
2018-12-04T11:59:41 [I|app|] Started GET "/notification_recipients" for 192.168.56.1 at 2018-12-04 11:59:41 -0500
2018-12-04T11:59:41 [I|app|3feea] Processing by NotificationRecipientsController#index as JSON
2018-12-04T11:59:41 [I|app|3feea] Current user set to admin (admin)
2018-12-04T11:59:41 [I|app|3feea] Completed 200 OK in 12ms (Views: 0.3ms | ActiveRecord: 2.3ms)
2018-12-04T11:59:44 [I|app|] Started GET "/notification_recipients" for 192.168.56.102 at 2018-12-04 11:59:44 -0500
2018-12-04T11:59:44 [I|app|ca270] Processing by NotificationRecipientsController#index as JSON
2018-12-04T11:59:44 [I|app|ca270] Current user set to admin (admin)
2018-12-04T11:59:44 [I|app|ca270] Completed 200 OK in 9ms (Views: 0.2ms | ActiveRecord: 1.7ms)

Sorry my bad, youā€™ll also need newer smart_proxy_ansible plugin, Iā€™ll send you the link once the rpm is available.

Sounds good. Thank you.

@Marek_Hulan I havenā€™t had a chance yet, but can probably do it by EOW. Can you send me a link to the smart_proxy_ansible rpm as well? Thx!

@flaporta @paulcalabro hereā€™s the scratch build for new smart_proxy_ansible if you want to give it a shot, Iā€™ll test myself during today, Iā€™m waiting on a machine

1 Like

Hi Marek,

I was able to get past the error I was getting using the new Smart-Proxy rpm. Thank you very much for working on that. Iā€™ll try to do some more testing using Ansible 2.30 and see how it goes. Iā€™m very excited. :sunglasses:

Thank you,
Fab

Ok, I realized youā€™d also need newer foreman_ansible_core from nightlies. After installing, both foreman-tasks and smart_proxy_dynflow_core services needs to be restarted.

I then see variables in UI and can setup overrides but for some reason, they donā€™t make it to generated inventory file. I have no idea why yet, will need to dig deeper into it.

1 Like

thanks for the update, Iā€™ll install the foreman_ansible_core from the nightlies.