Ask Your Question
0

How do I change the port jenkins runs on with puppet?

asked 2014-07-21 15:07:13 -0500

spuder gravatar image

If you use the Jenkins puppet module, the server starts by default on port 8080.

How can I change the port number without replacing the entire config file?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2014-11-05 06:21:48 -0500

rob777 gravatar image

I'm using https://forge.puppetlabs.com/rtyler/j... Port 80 did not work for me. I assume this to be related to ports below 1024 requiring special (/root) permissions on Linux.

These hiera files work for me:

common.yaml

---
jenkins::config_hash:
  HTTP_PORT:
    value: 8085

common.json

{
    "jenkins::config_hash": {
        "HTTP_PORT": {"value": "8085"}
    }
}
edit flag offensive delete link more
1

answered 2014-09-22 12:40:50 -0500

rfay gravatar image

If you're using rtyler/jenkins, put this in hiera:

jenkins::config_hash:
  JENKINS_PORT:
    value: 8888

You can also set JENKINSPORT to -1 and set JENKINSHTTPS_PORT the same way

edit flag offensive delete link more
0

answered 2014-07-21 15:11:15 -0500

spuder gravatar image

updated 2014-07-21 15:15:33 -0500

Use Augeas to replace a single line in a config file.

For example

class augeasfun {

$jenkins_config_location = $osfamily ? {
  'RedHat' => '/etc/sysconfig/jenkins',
  'Debian' => '/etc/default/jenkins',
  default => fail("Jenkins config directory is not set for os: \'${::osfamily}\'")
}
$jenkins_port = 80

augeas { 'jenkins port' :
  context => "/files/$jenkins_config_location",
  changes => "set JENKINS_PORT $jenkins_port",
  onlyif  => "match JENKINS_PORT[.='$jenkins_port'] size == 0",    }

}
include augeasfun

Alternatively use the file_line function in the pupeptlabs standard lib http://puppetlabs.com/blog/module-of-the-week-puppetlabsstdlib-puppet-labs-standard-library

edit flag offensive delete link more

Comments

Better yet, use the `shellvar` provider from augeasproviders.com

Raphink gravatar imageRaphink ( 2014-07-22 03:26:38 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-07-21 15:07:13 -0500

Seen: 713 times

Last updated: Nov 05 '14