ansible-role-jenkins
                                
                                 ansible-role-jenkins copied to clipboard
                                
                                    ansible-role-jenkins copied to clipboard
                            
                            
                            
                        Port Changes and other defaults cannot be over ridden with the latest release.
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.
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"}
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"
Full details on change, explaining also effects on various distributions, from Jenkins: https://www.jenkins.io/blog/2022/03/25/systemd-migration/
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?
I think we can drop init.
Hello! Any news?
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!