Skip to content
This repository has been archived by the owner on May 5, 2018. It is now read-only.

Jenkins Instances

xprazak2 edited this page Apr 16, 2015 · 6 revisions

Abstract representation of real Jenkins servers at our disposal.

Create Jenkins Instance

Foreman needs SSH access to the machine running Jenkins. Foreman uses RSA certificates for authentication to Jenkins server, these have to be set up manually. You will need to know Jenkins server hostname and ip address.

  1. To resolve Jenkins server ip address, use dig:
dig +short <jenkins_hostname>

if dig is not available for some reason, you may use nslookup as an alternative:

nslookup <jenkins_hostname>
  1. then add Jenkins to the list of known hosts:
ssh-keyscan <jenkins_hostname>,<ip_address> >> ~/.ssh/known_hosts
  1. and generate a keypair:
ssh-keygen -f ~/.ssh/<keyname> -t rsa -N '' -q
  1. distribute the public key to the Jenkins server:
cat ~/.ssh/<keyname>.pub | ssh root@<jenkins_hostname> "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
  1. prompt for root's password on Jenkins server will be displayed:
root@jenkins.example.com's password:

enter a password.

  1. verify that certificate has been copied and authentication works:
ssh -i ~/.ssh/<keyname> root@<jenkins_hostname>

you should see something like this:

root@<jenkins_hostname>
Last login: <date and time> from <somewhere>

Now you can create Jenkins instance. Go to main menu, Pipeline > Jenkins Instances. Click on the 'New Jenkins Instance' button on the right.

Fill in all the required fields. Jenkins home folder defaults to /var/lib/jenkins for Red Hat family operating systems. For Certificate Path, add path where certificate generated in steps above is reachable (i.e. ~/.ssh/<keyname>)

WARNING: certificates are usually stored in ~/.ssh/ folder (as in steps above). Make sure user running Foreman has appropriate access rights to this folder. Jenkins Instance will not be created if certificates are not set up properly.

Configure Jenkins Instance

Got to main menu, Pipeline > Jenkins Instances. Click on the Jenkins Instance Name in the table.

Test Jenkins reachability - Click on the 'Jenkins reachable?' button. If Jenkins can be reached, success message with Jenkins server version will be displayed.