Search This Blog

Friday, February 26, 2016

Building TheForeman Smart-Proxy from git source on SLES 11sp3

So for months I've been battering my head at the day job trying to integrate puppet in a meaningful fashion.  I wanted The Foreman; a nifty front end manager for both salt AND puppet which allows lifecycle management with relative ease.

Relative is key here, NOTHING is simple in the world of devops.

So I ran into an issue; our puppet-master installation is on a SLES 11.3 box.  Despite getting a CENTOS 6.5 vm setup for theforeman, I needed to somehow run my existing master through a separate Foreman front end.

This is where smart proxies come in.  In a normal, sane, non SLES system, you'd just do something stupid like "apt-get install foreman-proxy" or something like that. Not SLES, nope.

Instead you have to install git:
zypper addrepo http://download.opensuse.org/repositories/devel:/tools:/scm/SLE_11_SP3/devel:tools:scm.repo

zypper addrepo http://download.opensuse.org/repositories/devel:/languages:/perl/SLE_11_SP3/devel:languages:perl.repo

zypper refresh

zypper install git-core

Then you have to prep and clone the source:
     mkdir /var/share/foreman-proxy
    git clone git://github.com/theforeman/smart-proxy.git /var/share/foreman-proxy
    useradd -r foreman-proxy
    mkdir /var/log/foreman-proxy
    mkdir /usr/share/foreman-proxy/ssl
    mkdir /usr/share/foreman-proxy/ssl/certs
    mkdir /usr/share/foreman-proxy/ssl/private_keys
    cd /usr/share/foreman-proxy
    chown -R foreman-proxy:root /usr/share/foreman-proxy/ssl
    chown -R foreman-proxy:foreman-proxy /var/log/foreman-proxy
    there's more, but I'm not 100% on the process so I'll just give you my reference: http://projects.theforeman.org/projects/foreman/wiki/_passenger_on_Puppet_PE_and_use_foreman_as_an_ENC_and_reporting_engine_
Then you have to build/install the source:
cd /usr/share/foreman-proxy
gem build smart_proxy.gemspec
gem install smart_proxy-1.12.0.develop.gem     #note, your ver may vary depending on build's output!
It goes and acts completed but still won't run.
 So that didn't work..

gem install bundler
zypper install ruby1.8-rubygem-ruby-augeas             #requires dev libs/opensuse etc.
cd /usr/share/foreman-proxy bundle install
cd /usr/share/foreman-proxy/bin
./smart-proxy

And I get an error.
There's also a /usr/bin/smart-proxy that gives a different error.
Regardless, this is where we are!


This is as far as I've gotten and given the limited nature of queries on the internet which actually had answers, hopefully this will help some other poor bastard stuck on SLES with a similar issue.

*** addendum 10:45am ***
Turns out after you install smart proxy via bundler, you have to do this:
cd /usr/share/foreman-proxy
bundle exec bin/smart-proxy

At which time you'll discover you need to have a valid settings.yml  file.
That is located in config/settings.yml.example.  So cp that file to config/settings.yml and modify it as needed.  Then rerun bundle exec bin/smart-proxy  and you should have something akin to success!

No comments: