I’m trying to connect my foreman instance to my phpipam in order to use it as external IPAM, I saw this post about external IPAM being merged into core feature and tried following the official documentation for plugin install but after installing gem file from rubygems.org and adding Gemfile.local.rb and reloading foreman service I have an error (log below).
I’m not sure if I’m doing something wrong or if there is a compatibility issue as I see that the plugin was not much updated since 2 years, may I ask for some help with this setup ?
Expected outcome:
Being able to use phpipam as external IPAM
Foreman and Proxy versions:
Foreman 3.4.0
Foreman and Proxy plugin versions:
phpipam 1.5
smart_proxy_ipam 0.1.4
Distribution and version:
Other relevant data:
systemd[1]: Starting Foreman...
foreman[82903]: /usr/share/gems/gems/bundler-2.2.24/lib/bundler/dsl.rb:266:in `method_missing': (Bundler::Dsl::DSLError)
foreman[82903]: [!] There was an error parsing `Gemfile.in`: Undefined local variable or method `smart_proxy_ipam' for Gemfile. Bundler c>
foreman[82903]: # from /usr/share/foreman/Gemfile.in:62
foreman[82903]: # -------------------------------------------
foreman[82903]: # Dir["#{File.dirname(FOREMAN_GEMFILE)}/bundler.d/*.rb"].each do |bundle|
foreman[82903]: > instance_eval(Bundler.read_file(bundle))
foreman[82903]: # end
foreman[82903]: # -------------------------------------------
foreman[82903]: from (eval):1:in `block in eval_gemfile'
foreman[82903]: from /usr/share/foreman/Gemfile.in:62:in `instance_eval'
foreman[82903]: from /usr/share/foreman/Gemfile.in:62:in `block in eval_gemfile'
foreman[82903]: from /usr/share/foreman/Gemfile.in:61:in `each'
foreman[82903]: from /usr/share/foreman/Gemfile.in:61:in `eval_gemfile'
foreman[82903]: from /usr/share/gems/gems/bundler-2.2.24/lib/bundler/dsl.rb:47:in `instance_eval'
foreman[82903]: from /usr/share/gems/gems/bundler-2.2.24/lib/bundler/dsl.rb:47:in `eval_gemfile'
foreman[82903]: from /usr/share/gems/gems/bundler-2.2.24/lib/bundler/dsl.rb:12:in `evaluate'
foreman[82903]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/gemfile.rb:46:in `parse'
foreman[82903]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in `system_require'
foreman[82903]: from /usr/share/foreman/config/application.rb:36:in `<top (required)>'
foreman[82903]: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
foreman[82903]: from /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `block in require'
foreman[82903]: from /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:299:in `load_dependency'
foreman[82903]: from /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `require'
foreman[82903]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/commands/server/server_command.rb:138:in `block in perform'
foreman[82903]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/commands/server/server_command.rb:135:in `tap'
foreman[82903]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/commands/server/server_command.rb:135:in `perform'
foreman[82903]: from /usr/share/gems/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
foreman[82903]: from /usr/share/gems/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
foreman[82903]: from /usr/share/gems/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
foreman[82903]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/command/base.rb:69:in `perform'
foreman[82903]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/command.rb:48:in `invoke'
foreman[82903]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/commands.rb:18:in `<top (required)>'
foreman[82903]: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in `require'
foreman[82903]: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in `rescue in require'
foreman[82903]: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:147:in `require'
foreman[82903]: from /usr/share/foreman/bin/rails:9:in `<main>'
I did try without the single quote around so maybe I pick the log with this syntax, but my first try was with the single quotes around and I had this error :
systemd[1]: Failed to start Foreman.
systemd[1]: Starting Foreman...
foreman[87530]: /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/output.rb:13:in `strict_err': Gem loading error: cannot load such file -- smart_proxy_ipam (RuntimeError)
foreman[87530]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:46:in `rescue in block in system_require'
foreman[87530]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:39:in `block in system_require'
foreman[87530]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:37:in `each'
foreman[87530]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext/runtime.rb:37:in `system_require'
foreman[87530]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:19:in `block in system_require'
foreman[87530]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in `each'
foreman[87530]: from /usr/share/gems/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in `system_require'
foreman[87530]: from /usr/share/foreman/config/application.rb:36:in `<top (required)>'
foreman[87530]: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
foreman[87530]: from /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `block in require'
foreman[87530]: from /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:299:in `load_dependency'
foreman[87530]: from /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `require'
foreman[87530]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/commands/server/server_command.rb:138:in `block in perform'
foreman[87530]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/commands/server/server_command.rb:135:in `tap'
foreman[87530]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/commands/server/server_command.rb:135:in `perform'
foreman[87530]: from /usr/share/gems/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
foreman[87530]: from /usr/share/gems/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
foreman[87530]: from /usr/share/gems/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
foreman[87530]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/command/base.rb:69:in `perform'
foreman[87530]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/command.rb:48:in `invoke'
foreman[87530]: from /usr/share/gems/gems/railties-6.1.6.1/lib/rails/commands.rb:18:in `<top (required)>'
foreman[87530]: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in `require'
foreman[87530]: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in `rescue in require'
foreman[87530]: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:147:in `require'
foreman[87530]: from /usr/share/foreman/bin/rails:9:in `<main>'
Hi did you find a solution for getting ipam to work in foreman? If you don’t mind sharing I am interested in step by step details to get this working. Thanks
Thanks for the info. Yes, I’ve been asking Chris, the guy that owns it but it seem for some reason there are issues trying to get this pulled in. It is not pressing either but would be a nice thing to incorp in Foreman but it is taking forever.
Well, if you do start trying again and get any further along I am interested in the steps. Thanks
I was able to get the PHPIPAM connection working on my local foreman instance. I originally installed it on foreman 3.3 and have rolled it forward to 3.5 successfully. My PHPIPAM version was originally 1.5.1 and has been rolled forward to 1.5.3.
I found the following two pages on rubydoc.info on how to install the plugins and configure them with your instances:
Set up your configurations:
A. Copy /usr/local/share/gems/gems/smart_proxy_ipam-0.1.4/settings.d/externalipam_phpipam.yml.example to /etc/foreman-proxy/settings.d/externalipam_phpipam.yml , replace values with your phpIPAM URL and credentials (Step 3 walks you through how to set them up if needed, can come back and fill in the appropriate values).
B. Copy /usr/local/share/gems/gems/smart_proxy_ipam-0.1.4/settings.d/externalipam.yml.example to /etc/foreman-proxy/settings.d/externalipam.yml and set enabled to true, and use_provider to externalipam_phpipam.
The tricky part for me was the PHPIPAM configuration since you need to create an API token and user with the same name:
A .Create a User and API Key in phpIPAM, and ensure they are both named exactly the same.
B. The “App Security” setting for your API key should be “User token”
C. Add the url and User name and password to the configuration at /etc/foreman-proxy/settings.d/externalipam_phpipam.yml
Make sure to restart the appropriate services (foreman and foreman-proxy) and refresh your proxy capabilities.