File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,11 @@ jenkins_plugins:
83
83
jenkins_custom_plugins : []
84
84
85
85
# Configs specific to the "docker" method of running jenkins
86
+ # The name of the jenkins container
86
87
jenkins_docker_container_name : jenkins
88
+ # Default, if true, the port will be exposed on the host (using "port")
89
+ # If set to false, the port will only be exposed to other containers (using "expose")
90
+ jenkins_docker_expose_port : true
87
91
` ` `
88
92
89
93
Example Playbook
@@ -123,6 +127,10 @@ This gives you more flexibility and better separation of concerns. See
123
127
the documentation in those projects for more details on how to deploy
124
128
the proxies and configure HTTPS.
125
129
130
+ If using a reverse proxy in front of the jenkins instance you probably
131
+ want to set the ` jenkins_docker_expose_port` var to false so that the
132
+ port is not exposed on the host, only to the reverse proxy.
133
+
126
134
Jenkins Configs
127
135
---------------
128
136
Original file line number Diff line number Diff line change @@ -45,4 +45,9 @@ jenkins_plugins:
45
45
jenkins_custom_plugins : []
46
46
47
47
# Configs specific to the "docker" method of running jenkins
48
+ # The name of the jenkins container
48
49
jenkins_docker_container_name : jenkins
50
+
51
+ # Default, if true, the port will be exposed on the host (using "port")
52
+ # If set to false, the port will only be exposed to other containers (using "expose")
53
+ jenkins_docker_expose_port : true
Original file line number Diff line number Diff line change 8
8
group : " {{ jenkins_config_group }}"
9
9
state : directory
10
10
11
- - name : Container is running
11
+ - name : Container is running (with ingress port)
12
12
docker_container :
13
13
name : " {{ jenkins_docker_container_name }}"
14
14
image : " jenkins:{{ jenkins_version }}"
19
19
env :
20
20
JAVA_OPTS : " {{ jenkins_java_opts }}"
21
21
register : container_result
22
+ when : jenkins_docker_expose_port
23
+
24
+ - name : Container is running (without ingress port)
25
+ docker_container :
26
+ name : " {{ jenkins_docker_container_name }}"
27
+ image : " jenkins:{{ jenkins_version }}"
28
+ expose : " 8080"
29
+ volumes :
30
+ - " {{ jenkins_home }}:/var/jenkins_home"
31
+ env :
32
+ JAVA_OPTS : " {{ jenkins_java_opts }}"
33
+ register : container_result
34
+ when : not jenkins_docker_expose_port
22
35
23
36
- pause :
24
37
seconds : 45
You can’t perform that action at this time.
0 commit comments