ansible-role-jenkins icon indicating copy to clipboard operation
ansible-role-jenkins copied to clipboard

Port Changes and other defaults cannot be over ridden with the latest release.

Open jlombardo29 opened this issue 3 years ago • 7 comments

With the release of 2.332.1 there have been some changes to how Jenkins looks for overrides.

https://www.jenkins.io/doc/book/system-administration/systemd-services/

TL:DR SystemD is the new standard so the defaults file isn't working as it used to.

jlombardo29 avatar Mar 29 '22 18:03 jlombardo29

It looks like in CI I'm also getting some failures, like:

failed: [instance] (item=ghprb) => {"ansible_loop_var": "item", "attempts": 3, "changed": false, "details": "HTTP Error 401: Unauthorized", "item": "ghprb", "msg": "Cannot get CSRF"}

geerlingguy avatar Apr 05 '22 15:04 geerlingguy

This needs some polishing (use all vars in teplate), but it should work:

- name: Create override directory
  file:
    path: /etc/systemd/system/jenkins.service.d
    state: directory

- name: Add overrides
  template:
    src: override.conf.j2
    dest: /etc/systemd/system/jenkins.service.d/override.conf
    mode: 0644

And then in your templates/override.conf.j2 add all your required options:

[Unit]
Description=My Jenkins Controller

[Service]
# Add JVM configuration options
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false "

# Arbitrary additional arguments to pass to Jenkins.
Environment="JENKINS_OPTS=--prefix={{ jenkins_url_prefix }} --javaHome=/opt/jdk-11"

impca avatar Apr 06 '22 14:04 impca

Full details on change, explaining also effects on various distributions, from Jenkins: https://www.jenkins.io/blog/2022/03/25/systemd-migration/

bzoks avatar Apr 08 '22 09:04 bzoks

Would a PR need to support both init and systemd (to support older versions of Jenkins + derivatives without systemd)? Or are we able to switch over to systemd completely?

ghost avatar Jun 03 '22 15:06 ghost

I think we can drop init.

geerlingguy avatar Jun 03 '22 15:06 geerlingguy

Hello! Any news?

patsevanton avatar Jul 27 '22 05:07 patsevanton

Just left a note on the #354 PR, sorry about not noticing this sooner, I do want to get this role back into a fully-functional state!

geerlingguy avatar Jul 27 '22 14:07 geerlingguy