@@ -39,91 +39,35 @@ $ ansible-galaxy install emmetog.jenkins
39
39
Role Variables
40
40
--------------
41
41
42
- ``` yml
43
- jenkins_version : " 2.73.1" # The exact version of jenkins to deploy
44
-
45
- jenkins_url : " http://127.0.0.1" # The url that Jenkins will be accessible on
46
- jenkins_port : " 8080" # The port that Jenkins will listen on
47
- jenkins_home : /data/jenkins # The directory on the server where the Jenkins configs will live
48
- jenkins_admin : " admin@example.com" # The admininstrator email address for the Jenkins server
49
-
50
- # If you need to override any java options then do that here.
51
- jenkins_java_opts : " -Djenkins.install.runSetupWizard=false"
52
-
53
- # Install Jenkins by means of a Docker container
54
- jenkins_install_via : " docker"
55
-
56
- # Install Jenkins directly on Ubuntu/Debian Linux systems
57
- jenkins_install_via : " apt"
58
-
59
- # Install Jenkins directly on RedHat/CentOS Linux systems
60
- jenkins_install_via : " yum"
61
-
62
- # Configuration files owner and group
63
- jenkins_config_owner : " ubuntu"
64
- jenkins_config_group : " ubuntu"
65
-
66
- # The locations of the configuration files for jenkins
67
- jenkins_source_dir_configs : " {{ playbook_dir }}/jenkins-configs"
68
- jenkins_source_dir_jobs : " {{ jenkins_source_dir_configs }}/jobs"
69
-
70
- # config.xml template source
71
- jenkins_source_config_xml : " {{ jenkins_source_dir_configs }}/config.xml"
42
+ The following variables influence how Jenkins is installed:
72
43
73
- # Include custom files for jenkins installation
74
- jenkins_include_custom_files : false
75
- jenkins_custom_files : {}
44
+ - ` jenkins_install_via ` : Controls how Jenkins is installed. ** Important** : This
45
+ variable must be defined to one of the following values:
46
+ - ` docker ` : Install in a Docker container
47
+ - ` apt ` : Install Jenkins directly on Ubuntu/Debian Linux systems
48
+ - ` yum ` : Install Jenkins directly on RedHat/CentOS Linux systems
49
+ - ` jenkins_version ` : The exact version of jenkins to install
76
50
77
- # Include secrets directory during installation
78
- jenkins_include_secrets : false
79
- jenkins_source_secrets : " {{ jenkins_source_dir_configs }}/secrets/"
51
+ The following variables influence how Jenkins is configured:
80
52
81
- # The names of the jobs (config.xml must exist under jenkins_source_dir_jobs/job_name/)
82
- jenkins_jobs : []
53
+ - ` jenkins_url ` : The URL that Jenkins will be accessible on
54
+ - ` jenkins_port ` : The port that Jenkins will listen on
55
+ - ` jenkins_home ` : The directory on the server where the Jenkins configs will
56
+ live
57
+ - ` jenkins_admin ` : The administrator's email address for the Jenkins server
58
+ - ` jenkins_java_opts ` : Options passed to the Java executable
59
+ - ` jenkins_config_owner ` : Owner of Jenkins configuration files
60
+ - ` jenkins_config_group ` : Group of Jenkins configuration files
83
61
84
- # These plugins will be installed in the jenkins instance
85
- jenkins_plugins :
86
- - git
87
- - log-parser
88
- - copyartifact
89
- - workflow-aggregator
90
- - workflow-multibranch
91
- - docker-workflow
92
- - template-project
93
- - ec2
62
+ The following list variables influence the jobs/plugins that will be installed
63
+ in Jenkins:
94
64
95
- # List of sources of custom jenkins plugins to install
96
- jenkins_custom_plugins : []
65
+ - ` jenkins_jobs ` : List of names of the jobs to copy to Jenkins. The ` config.xml `
66
+ file must exist under ` jenkins_source_dir_jobs/<job_name> `
67
+ - ` jenkins_plugins ` : List of plugin IDs to install on Jenkins.
68
+ - ` jenkins_custom_plugins ` : List of custom plugins to install on Jenkins.
97
69
98
- # ##################################################
99
- # Docker vars: apply to deploying via docker only #
100
- # ##################################################
101
-
102
- # The docker hub image name
103
- jenkins_docker_image : " jenkins/jenkins"
104
-
105
- # Configs specific to the "docker" method of running jenkins
106
- # The name of the jenkins container
107
- jenkins_docker_container_name : jenkins
108
-
109
- # Default, if true, the port will be exposed on the host (using "port")
110
- # If set to false, the port will only be exposed to other containers (using "expose")
111
- jenkins_docker_expose_port : true
112
-
113
-
114
- # ############################################
115
- # Apt vars: apply to deploying via apt only #
116
- # ############################################
117
-
118
- # Packages which are to be installed on the jenkins instance
119
- jenkins_apt_packages :
120
- - openjdk-8-jdk
121
-
122
- # Java version to use. Note that JDK 8 is required for Jenkins
123
- # 2.54 or greater.
124
- jenkins_java_version : " java-1.8.0-openjdk-amd64"
125
-
126
- ` ` `
70
+ For a complete list of variables, see [ ` defaults/main.yml ` ] ( defaults/main.yml ) .
127
71
128
72
Example Playbook
129
73
----------------
@@ -133,7 +77,7 @@ Example Playbook
133
77
134
78
vars :
135
79
jenkins_version : " 2.73.1"
136
- jenkins_url : http:// jenkins.example.com
80
+ jenkins_hostname : " jenkins.example.com"
137
81
jenkins_port : 80
138
82
jenkins_install_via : " docker"
139
83
jenkins_jobs :
@@ -154,18 +98,33 @@ Example Playbook
154
98
HTTPS
155
99
-----
156
100
157
- If you want to enable HTTPS on jenkins we recommend that you use a
158
- reverse proxy like [jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy)
159
- or [traefik](https://github.com/containous/traefik) and configure it
160
- as the HTTPS endpoint instead of configuring jenkins itself with HTTPS.
161
- This gives you more flexibility and better separation of concerns. See
162
- the documentation in those projects for more details on how to deploy
163
- the proxies and configure HTTPS.
164
-
165
- If using a reverse proxy in front of the jenkins
166
- instance and deploying using docker you probably
167
- want to set the ` jenkins_docker_expose_port` var to false so that the
168
- port is not exposed on the host, only to the reverse proxy.
101
+ If you want to enable HTTPS on Jenkins, this can be done as follows:
102
+
103
+ - Define ` jenkins_port_https` to the port that Jenkins should listen on
104
+ - Define variables *either* for the JKS keystore or the CA signed certificate :
105
+ * For JKS keystore, you'll need to define:
106
+ - `jenkins_https_keystore` : Path to the keystore file on the control host,
107
+ which will be copied to the Jenkins server by this role.
108
+ - `jenkins_https_keystore_password` : Password for said JKS keystore. Use of
109
+ the Ansible vault is recommended for this.
110
+ * For a CA signed certificate file, you'll need to define:
111
+ - `jenkins_https_certificate` : Path to the certificate file, which will be
112
+ copied to the Jenkins server by this role.
113
+ - `jenkins_https_private_key` : Private key for said CA signed certificate.
114
+ Use of the Ansible vault is recommended for this.
115
+ - Optionally, `jenkins_https_validate_certs` should be defined to `false` if
116
+ you are using a self-signed certificate.
117
+
118
+ If you are deploying Jenkins with Docker, then using a reverse proxy such as
119
+ [jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy) or
120
+ [traefik](https://github.com/containous/traefik) is recommended instead of
121
+ configuring Jenkins itself. This gives a bit more flexibility and allows for
122
+ separation of responsibilities. See the documentation in those projects for
123
+ more details on how to deploy the proxies and configure HTTPS.
124
+
125
+ If using a reverse proxy in front of the Jenkins instance and deploying using
126
+ Docker you probably want to set the `jenkins_docker_expose_port` variable to
127
+ false so that the port is not exposed on the host, only to the reverse proxy.
169
128
170
129
Authentication and Security
171
130
---------------------------
0 commit comments