Quick confirmation re: foreman_ansible v2.3.0

ansible

#1

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


#2

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.


#3

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:


#4

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.


#5

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.


#6

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


#7

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.


#8

Thanks that info. That’s very helpful!


#9

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?


#10

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


#11

@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.


#12

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.


#13

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)

#14

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


#15

Sounds good. Thank you.


#16

@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!


#17

@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


#18

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


#19

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.


#20

thanks for the update, I’ll install the foreman_ansible_core from the nightlies.