Skip to content

Commit bb7eb8b

Browse files
nre-abletonemmetog
authored andcommitted
Configure Jenkins location and admin email (#14)
This commit creates jenkins.model.JenkinsLocationConfiguration.xml, which is automatically generated by Jenkins but only after one manually saves the system configuration. Until this file is generated, several Jenkins-related environment variables use "http://unconfigured-jenkins-location" as the server URL. This change also introduces the jenkins_admin variable for the administrator's email address, since that is contained in the same XML file.
1 parent 5171116 commit bb7eb8b

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jenkins_version: "2.32.3" # The exact version of jenkins to deploy
4242
jenkins_url: "http://127.0.0.1" # The url that Jenkins will be accessible on
4343
jenkins_port: "8080" # The port that Jenkins will listen on
4444
jenkins_home: /data/jenkins # The directory on the server where the Jenkins configs will live
45+
jenkins_admin: "admin@example.com" # The admininstrator email address for the Jenkins server
4546

4647
# If you need to override any java options then do that here.
4748
jenkins_java_opts: "-Djenkins.install.runSetupWizard=false"

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ jenkins_version: "2.32.3" # The exact version of jenkins to deploy
44
jenkins_url: "http://127.0.0.1" # The url that Jenkins will be accessible on
55
jenkins_port: "8080" # The port that Jenkins will listen on
66
jenkins_home: /data/jenkins # The directory on the server where the Jenkins configs will live
7+
jenkins_admin: "admin@example.com" # The admininstrator email address for the Jenkins server
78

89
# If you need to override any java options then do that here.
910
jenkins_java_opts: "-Djenkins.install.runSetupWizard=false"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<jenkins.model.JenkinsLocationConfiguration>
3+
<adminAddress>{{ jenkins_admin }}</adminAddress>
4+
<jenkinsUrl>{{ jenkins_url }}:{{ jenkins_port }}</jenkinsUrl>
5+
</jenkins.model.JenkinsLocationConfiguration>

tasks/configure-jenkins.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
owner: "{{ jenkins_config_owner }}"
99
group: "{{ jenkins_config_group }}"
1010

11+
- name: Configure Jenkins location
12+
template:
13+
src: files/jenkins.model.JenkinsLocationConfiguration.xml.j2
14+
dest: "{{ jenkins_home }}/jenkins.model.JenkinsLocationConfiguration.xml"
15+
mode: 0644
16+
owner: "{{ jenkins_config_owner }}"
17+
group: "{{ jenkins_config_group }}"
18+
1119
- name: Create intermediate dirs for custom files
1220
file:
1321
path: "{{ jenkins_home }}/{{ item.dest | dirname }}"

0 commit comments

Comments
 (0)