Jenkins and the Ansible plugin

I have been slacking on posting anything as of late and it hasn’t been from lack of topics, but my latest client has been me keeping quite engaged. The project has been really cool. I’ve been leading an installation of Red Hats PaaS environment, Openshift. Part of our engagement has been to demonstrate how DevOps and PaaS can increase developer productivity, quality of code, decrease time to market, and confidence the application will do what is supposed to.

During any installation of Openshift the recommendation is to always stand up DNS server specific for Openshift. The reason is that DNS dynamically adds and removes records as containers are added/removed from the PaaS and most network admins are not keen on allowing these dynamic features in the enterprise DNS servers (and rightfully so). This causes problems though. This means that any computer that logs into the Openshift console and creates a container won’t be able to access the container, because their computer won’t be able to resolve the new DNS entry. The fix is to basically forward on traffic to this server from the enterprise servers. However, since making such a change to a company’s DNS server(s) is not something to take lightly and takes time to evaluate risks and such, you may need to create a workaround like adding the Openshift DNS server to your computers list of DNS resolvers.

So nice workaround, right? Well, yes and no. We have worked around the issue of having the developers computer be able to resolve the correct FQDN, cool. What happens when as part of our DevOps process we leverage enterprise Jenkins server to push code directly to Openshift? You got it, the FQDN won’t resolve. The FQDN will not resolve without the correct DNS server.

What do you do? I mean the current set up is only temporary while the new enterprise DNS servers are set up to forward to the Openshift DNS. We really can’t blindly update the DNS servers for Jenkins, because there are a number of other development teams and quite possibly break their builds.

So what do we do… Yes, you got it. Ansible.

jenkins openshift bridge

We will use Ansible to bridge the Jenkins server to our server running the correct DNS to then remotely push an application to Openshift.You may  be asking yourself why not just use ssh? There are a few other little tidbits I didn’t mention and that is Openshift requires a special set of client tools that are not installed on the Jenkins server. There is a Openshift plugin which works, but only with ssh keys. The Jenkins server doesn’t use SSH keys, so no Openshift Plugin. However, even if we could use SSH keys the jenkins server wouldn’t be able to resolve the hostname. Which brings us back to using Ansible to execute commands on the bridge VM and then uses the Openshift client tools and the correct DNS server resolve and push code.

We ran into other issues with using the Ansible plugin that I’ll talk about in another post.

installing Openshift v2: devil’s in the details

This past several weeks I’ve been venturing into Red Hat’s Cloud PAAS technology, Openshift. I attempted to install the community version (origin) and the enterprise version. I had mixed luck. With the community version the documentation was incredible, I mean a monkey could do the installation based off of their instructions, really is top notch. Great Job guys! I ran into some packages not being quite stable so i decided then try the enterprise distribution.

So not being an expert (yet!) in Installing/Configuring openshift I needed to rely on the instructions heavily, don’t judge 🙂 . I had no real issues to speak of doing the installation until I installed the broker console. Then I was getting this friendly error:

[root@broker ~]# service openshift-broker start
Starting openshift-broker: Unable to open /etc/scl/prefixes/v8314!
chown: cannot access `Gemfile.lock': No such file or directory
Bundle failed
Run 'bundle install --local' in /var/www/openshift/broker/ to see the problem.

Being a newbie to Red Hats Software Collections I was not sure what the error was and/or why I was getting it. So I cracked open the code base and noticed that the version of ruby I was using was calling this cryptically named command v8134 and without fail couldn’t figure out what it was. I asked a few of my colleagues, but to no avail came up short.

soooo, I checked to see if anybody else had come across this issue before and when the whole error is entered no dice, so I started taking bits off and only leaving the core part of the error and like magic I found the bug had been reported by someone else ( Turns out the RPM file accidentally left off that dependency. And manually installing the v8134 with yum install fixed my issue. All I can say is awesome! Because I could finally move on.

I was able to set up my host no problem and now I’m ready for consumers….jk

lesson learned always google for bugs, trim out error and/or go to vendors site and search their known bugs.