├── .gitignore ├── LICENSE ├── README.rst ├── apache ├── tomcat-8 │ ├── configuration-copy │ │ ├── tasks │ │ │ ├── check.yml │ │ │ ├── configure.yml │ │ │ └── main.yml │ │ └── vars │ │ │ └── main.yml │ ├── configuration-default │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ ├── check.yml │ │ │ ├── configure.yml │ │ │ └── main.yml │ │ └── vars │ │ │ └── main.yml │ ├── install │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ ├── check.yml │ │ │ ├── download.yml │ │ │ ├── install.yml │ │ │ └── main.yml │ │ └── vars │ │ │ └── main.yml │ └── instance │ │ ├── defaults │ │ └── main.yml │ │ ├── meta │ │ └── main.yml │ │ ├── tasks │ │ ├── check.yml │ │ ├── install.yml │ │ └── main.yml │ │ ├── templates │ │ └── bin │ │ │ ├── catalina.sh │ │ │ ├── setenv.sh │ │ │ ├── shutdown.sh │ │ │ └── startup.sh │ │ └── vars │ │ └── main.yml └── tomcat │ └── defaults │ └── defaults │ └── main.yml ├── doc ├── Makefile ├── _references.txt ├── ansible │ └── __init__.py ├── coding_standards.rst ├── conf.py ├── index.rst ├── make.bat └── roles │ ├── apache-tomcat-8 │ ├── configuration-copy.rst │ ├── configuration-defaults.rst │ ├── install.rst │ └── instance.rst │ ├── apache-tomcat.rst │ ├── apache-tomcat │ └── defaults.rst │ ├── jenkins.rst │ ├── jenkins │ ├── bootstrap-job.rst │ ├── configure-email-notification.rst │ ├── configure-proxy.rst │ ├── configure.rst │ ├── deploy.rst │ └── plugins.rst │ ├── lang.rst │ └── lang │ ├── groovy-sdk.rst │ └── oracle-sdk.rst ├── jenkins ├── bootstrap-job │ ├── tasks │ │ ├── check.yml │ │ ├── configure.yml │ │ └── main.yml │ ├── templates │ │ └── init.groovy.d │ │ │ └── 80_configure-bootstrap-job.groovy │ └── vars │ │ └── main.yml ├── configure-email-notification │ ├── tasks │ │ ├── check.yml │ │ ├── configure.yml │ │ └── main.yml │ ├── templates │ │ └── init.groovy.d │ │ │ └── configure-email-notification.groovy │ └── vars │ │ └── main.yml ├── configure-proxy │ ├── tasks │ │ ├── check.yml │ │ ├── configure.yml │ │ └── main.yml │ ├── templates │ │ └── init.groovy.d │ │ │ └── configure-proxy.groovy │ └── vars │ │ └── main.yml ├── configure │ ├── defaults │ │ └── main.yml │ ├── tasks │ │ ├── check.yml │ │ ├── configure.yml │ │ └── main.yml │ ├── templates │ │ ├── authentication │ │ │ ├── active_directory.groovy │ │ │ ├── hudson_private.groovy │ │ │ └── no_authentication.groovy │ │ ├── authorization │ │ │ ├── full_control_once_logged_in.groovy │ │ │ ├── global_matrix.groovy │ │ │ ├── no_authorization.groovy │ │ │ └── project_matrix.groovy │ │ └── init.groovy.d │ │ │ ├── configure-location-properties.groovy │ │ │ └── configure_users.groovy │ └── vars │ │ └── main.yml ├── deploy │ ├── defaults │ │ └── main.yml │ ├── tasks │ │ ├── check.yml │ │ ├── download.yml │ │ ├── install.yml │ │ └── main.yml │ ├── templates │ │ └── catalina_context.xml │ └── vars │ │ └── main.yml └── plugins │ ├── defaults │ └── main.yml │ ├── tasks │ ├── check.yml │ ├── download.yml │ ├── install.yml │ └── main.yml │ └── vars │ └── main.yml └── lang ├── groovy ├── defaults │ └── main.yml ├── tasks │ ├── check.yml │ ├── download.yml │ ├── install.yml │ └── main.yml └── vars │ └── main.yml └── java └── oracle-sdk ├── defaults └── main.yml ├── tasks ├── check.yml ├── download.yml ├── install.yml └── main.yml └── vars └── main.yml /.gitignore: -------------------------------------------------------------------------------- 1 | doc/_build/ 2 | *.pyc 3 | README.html 4 | 5 | # IDEA 6 | .idea/ 7 | *.iml 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Michael Jansen 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following 8 | disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided with the distribution. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 17 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | **************************** 2 | ANSIBLE JENKINS DEVOPS ROLES 3 | **************************** 4 | .. contents:: Table of Contents 5 | 6 | A set of roles to support automated installation of `jenkins`_ with `ansible`_. 7 | 8 | This is not a one size fits all role. Extensive customisation should be expected before your jenkins is running but 9 | at that point its running **FULLY** configured. No manual intervention needed. At least that is the goal. 10 | 11 | For an example playbook that makes use of this roles check my `examples repo`_. 12 | 13 | FEATURES 14 | -------- 15 | There are several steps already implemented 16 | 17 | #. Download `apache tomcat`_ and setup a tomcat instance 18 | #. Download jenkins and drop it into tomcat 19 | #. Download a configured set of plugins and activate them. 20 | #. Configure jenkins 21 | 22 | * authorization strategy 23 | * authentication strategy 24 | * notification settings 25 | * location properties 26 | * users (for hudson_private authentication strategy aka "Jenkins' own user database") 27 | * permissions (for hudson authorization strategies project_matrix and global_matrix) 28 | 29 | #. Create a bootstrap job that checks out from vcs and executes all `bootstrap/*.job` scripts with the `job-dsl plugin`_. 30 | 31 | .. IMPORTANT:: 32 | All roles are designed to be used outside this playbook. 33 | 34 | DOCUMENTATION 35 | ------------- 36 | Documentation is done with sphinx. The repository contains a alpha version of a ansible sphinx-domain in the 37 | subfolder `doc/ansible`. The documentation itself is hosted at `Read The Docs`_ 38 | 39 | OUTLOOK 40 | ------- 41 | There are several action points left on my plate. Those i remember right now :) 42 | 43 | Write a ansible coding standard:: 44 | The idea is to document all rules and conventions applied when writing these roles. I have for example a strict *no 45 | become for roles* policy. 46 | Implement more configuration roles:: 47 | Jenkins configuration is complex. I will implement all configuration i need for my daily work. 48 | Provide job templates:: 49 | The idea is to provide a list of job templates for common jobs. Eg build a 50 | 51 | - ruby gem 52 | - python egg 53 | - ... 54 | 55 | Finish the sphinx-ansible domain:: 56 | And then bring it up to sphinx-contrib. 57 | 58 | AUTHOR 59 | ------ 60 | `Michael Jansen`_ created Ansible Jenkins DevOps Roles 61 | 62 | LICENSE 63 | ------- 64 | Please see `LICENSE `_ 65 | 66 | .. Github does not support includes in README files!!!!!! 67 | .. _Michael Jansen: http://michael-jansen.biz 68 | .. _Read The Docs: http://ansible-jenkins-roles.readthedocs.org/en/latest/ 69 | .. _ansible: http://ansible.com 70 | .. _apache tomcat: https://tomcat.apache.org/ 71 | .. _examples repo: https://github.com/jansenm/ansible-jenkins-roles-example 72 | .. _jenkins: http://jenkins-ci.org 73 | .. _job-dsl plugin: https://github.com/jenkinsci/job-dsl-plugin 74 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-copy/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "CHECK | PARAMETERS" 3 | # ===================================================================== 4 | assert: 5 | that: 6 | # This is were the tomcat instance will be created 7 | - catalina_base is defined and catalina_base is not none 8 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-copy/tasks/configure.yml: -------------------------------------------------------------------------------- 1 | - name: CONFIGURE | COPY TOMCAT CONFIGURATION 2 | # ===================================================================== 3 | # rsync did not work. Need to find out why 4 | copy: 5 | src: "{{configuration}}/" 6 | dest: "{{catalina_base}}/conf" 7 | mode: 0700 8 | 9 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-copy/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: configure.yml 6 | tags: configure 7 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-copy/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Base directory of the new tomcat instance 2 | # catalina_base: 3 | 4 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-default/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - { role: "apache/tomcat/defaults" } 4 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-default/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "CHECK | PARAMETERS" 3 | # ===================================================================== 4 | assert: 5 | that: 6 | # Base of a existing and unpacked apache-tomcat archive 7 | - catalina_home is defined and catalina_home is not none 8 | # This is were the tomcat instance will be created 9 | - catalina_base is defined and catalina_base is not none 10 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-default/tasks/configure.yml: -------------------------------------------------------------------------------- 1 | - name: CONFIGURE | PREPARE TOMCAT CONFIGURATION 2 | # ===================================================================== 3 | command: cp -r "{{catalina_home}}/conf/" "{{catalina_base}}/conf" 4 | # Not yet :( https://github.com/ansible/ansible-modules-core/issues/2098 5 | # copy: 6 | # src: "{{catalina_home}}/conf/" 7 | # dest: "{{catalina_base}}/conf" 8 | # remote_src: yes 9 | # mode: 0700 10 | 11 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-default/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: configure.yml 6 | tags: configure 7 | -------------------------------------------------------------------------------- /apache/tomcat-8/configuration-default/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Base directory of the new tomcat instance 2 | # catalina_base: 3 | 4 | # Apache tomcat distribution to use. 5 | catalina_home: "{{apache_tomcat_8_instance_catalina_home}}" 6 | 7 | -------------------------------------------------------------------------------- /apache/tomcat-8/install/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - { role: "apache/tomcat/defaults" } 4 | -------------------------------------------------------------------------------- /apache/tomcat-8/install/tasks/check.yml: -------------------------------------------------------------------------------- 1 | - name: "CHECK | PARAMETERS" 2 | # ========================================================================= 3 | assert: 4 | that: 5 | # (localhost) where to cache the tomcat archive. 6 | - cache_directory is defined and cache_directory is not none 7 | # tomcat version to download (e.g. "8.0.28") 8 | - version is defined and version is not none 9 | # MD5 checksum to verify the archive (eg: ":" "md5:4b7ba7a5af0a5c395c0740fc011b59d1") 10 | - checksum is defined and checksum is not none 11 | 12 | -------------------------------------------------------------------------------- /apache/tomcat-8/install/tasks/download.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DOWNLOAD | CREATE DOWNLOAD CACHE DIRECTORY 3 | # =============================================================================== 4 | become: no 5 | delegate_to: 127.0.0.1 6 | action: file 7 | args: 8 | state: "directory" 9 | path: "{{cache}}" 10 | 11 | - name: DOWNLOAD | FETCH ARTIFACT 12 | # ===================================================================== 13 | action: get_url 14 | become: false 15 | delegate_to: 127.0.0.1 16 | args: 17 | url: "{{download_url}}" 18 | dest: "{{cache}}/{{archive_name}}" 19 | # :TODO: Ansible 2.0 - Enable 20 | # checksum: "{{tomcat_checksum}}" 21 | 22 | -------------------------------------------------------------------------------- /apache/tomcat-8/install/tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: INSTALL | EXTRACT ARCHIVE 3 | # ===================================================================== 4 | action: unarchive 5 | args: 6 | src: "{{cache}}//{{archive_name}}" 7 | dest: "{{prefix}}/" 8 | creates: "{{prefix}}/apache-tomcat-{{version}}" 9 | 10 | - name: INSTALL | MAKE CONF/ WORLD READABLE 11 | # ===================================================================== 12 | file: 13 | path: "{{prefix}}/apache-tomcat-{{version}}/conf" 14 | mode: "a+r" 15 | recurse: yes 16 | 17 | -------------------------------------------------------------------------------- /apache/tomcat-8/install/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: download.yml 6 | tags: download 7 | 8 | - include: install.yml 9 | tags: install 10 | -------------------------------------------------------------------------------- /apache/tomcat-8/install/vars/main.yml: -------------------------------------------------------------------------------- 1 | # tomcat version to download (e.g. "8.0.28") 2 | version: 3 | # MD5 checksum to verify the archive (eg: ":" "md5:4b7ba7a5af0a5c395c0740fc011b59d1") 4 | checksum: 5 | # Install prefix 6 | prefix: "{{apache_tomcat_prefix}}" 7 | # Local download cache directory 8 | # cache_directory: 9 | 10 | # Convenience variables. 11 | 12 | # The archive name to download. 13 | archive_name: "apache-tomcat-{{version}}.tar.gz" 14 | # The full url for the download. 15 | download_url: "{{apache_tomcat_download_mirror}}/tomcat-8/v{{version}}/bin/{{archive_name}}" 16 | # Role cache directory. 17 | cache: "{{cache_directory}}/apache.tomcat-8.core/" 18 | -------------------------------------------------------------------------------- /apache/tomcat-8/instance/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Tomcat manager apps to copy into the instance 2 | apache_tomcat_8_java_opts: "" 3 | 4 | # :TODO: in group_vars/all.yml 5 | apache_tomcat_8_default_versions: "8.0.32" 6 | 7 | apache_tomcat_8_instance_catalina_home: "{{apache_tomcat_prefix}}/apache-tomcat-{{tomcat_version|default(apache_tomcat_8_default_version)}}" 8 | 9 | apache_tomcat_8_instance_manager_apps: 10 | - "host-manager" 11 | - "manager" 12 | - "ROOT" 13 | - "examples" 14 | - "docs" 15 | -------------------------------------------------------------------------------- /apache/tomcat-8/instance/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - { role: "apache/tomcat/defaults" } 4 | -------------------------------------------------------------------------------- /apache/tomcat-8/instance/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "INIT | CHECK PARAMETERS" 3 | # ===================================================================== 4 | assert: 5 | that: 6 | # Base of a existing and unpacked apache-tomcat archive 7 | - catalina_home is defined and catalina_home is not none 8 | # This is were the tomcat instance will be created 9 | - catalina_base is defined and catalina_base is not none 10 | # The java that is going to be used. 11 | - java_home is defined and java_home is not none 12 | -------------------------------------------------------------------------------- /apache/tomcat-8/instance/tasks/install.yml: -------------------------------------------------------------------------------- 1 | - name: INSTALL | CREATE CATALINA_BASE 2 | # ===================================================================== 3 | action: file 4 | args: 5 | path: "{{catalina_base}}" 6 | state: "directory" 7 | mode: "0700" 8 | 9 | - name: INSTALL | PREPARE TOMCAT STRUCTURE (DIRECTORIES) 10 | # ===================================================================== 11 | action: file 12 | args: 13 | path: "{{catalina_base}}/{{item}}" 14 | state: "directory" 15 | with_items: 16 | - "bin" 17 | - "webapps" 18 | - "work" 19 | - "temp" 20 | - "logs" 21 | 22 | - name: INSTALL | PREPARE CONTROL SCRIPTS 23 | # ===================================================================== 24 | template: 25 | args: 26 | src: "{{item}}" 27 | dest: "{{catalina_base}}/{{item}}" 28 | mode: 0755 29 | with_items: 30 | - "bin/startup.sh" 31 | - "bin/shutdown.sh" 32 | - "bin/catalina.sh" 33 | - "bin/setenv.sh" 34 | 35 | - name: INSTALL | INSTALL DEFAULT APPLICATIONS 36 | # ===================================================================== 37 | command: cp -r "{{catalina_home}}/webapps/{{item}}" "{{catalina_base}}/webapps/" 38 | args: 39 | creates: "{{catalina_base}}/webapps/{{item}}" 40 | with_items: 41 | - "{{manager_apps}}" 42 | -------------------------------------------------------------------------------- /apache/tomcat-8/instance/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: install.yml 6 | tags: install -------------------------------------------------------------------------------- /apache/tomcat-8/instance/templates/bin/catalina.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # {{ansible_managed}} 3 | 4 | export CATALINA_BASE="{{catalina_base}}" 5 | "{{catalina_home}}/bin/catalina.sh" "$@" -------------------------------------------------------------------------------- /apache/tomcat-8/instance/templates/bin/setenv.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # {{ansible_managed}} 3 | 4 | export CATALINA_PID="{{catalina_base}}/temp/catalina.pid" 5 | export JAVA_HOME="{{java_home}}" 6 | export JAVA_OPTS="{{java_opts}}" 7 | -------------------------------------------------------------------------------- /apache/tomcat-8/instance/templates/bin/shutdown.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # {{ansible_managed}} 3 | 4 | export CATALINA_BASE="{{catalina_base}}" 5 | "{{catalina_home}}/bin/shutdown.sh" "$@" 6 | -------------------------------------------------------------------------------- /apache/tomcat-8/instance/templates/bin/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # {{ansible_managed}} 3 | 4 | export CATALINA_BASE="{{catalina_base}}" 5 | "{{catalina_home}}/bin/startup.sh" "$@" 6 | -------------------------------------------------------------------------------- /apache/tomcat-8/instance/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Base directory of the new tomcat instance 2 | # catalina_base: 3 | 4 | # Apache tomcat distribution to use. 5 | catalina_home: "{{apache_tomcat_8_instance_catalina_home}}" 6 | 7 | # Java installation to use. 8 | # java_home: 9 | 10 | # Options for the jvm 11 | java_opts: "{{apache_tomcat_8_java_opts}}" 12 | 13 | # Tomcat manager apps to copy into the instance 14 | manager_apps: "{{apache_tomcat_8_instance_manager_apps}}" 15 | -------------------------------------------------------------------------------- /apache/tomcat/defaults/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # The directory where the tomcat archive will be unpacked (but not run) 2 | apache_tomcat_prefix: "{{install_prefix}}/apache-tomcat" 3 | 4 | # The shutdown port. This is tomcats default. 5 | apache_tomcat_server_port: 8005 6 | 7 | # The non-ssl/tls http/1.1 connector port. This is tomcats default. 8 | apache_tomcat_http_connector_port: 8080 9 | 10 | # The ajp connector port. This is the tomcat default 11 | apache_tomcat_ajp_connector_port: 8009 12 | 13 | # URL for tomcat archive download. 14 | apache_tomcat_download_mirror: "http://mirror.synyx.de/apache/tomcat" 15 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXAUTOBUILD = sphinx-autobuild 8 | PAPER = 9 | BUILDDIR = _build 10 | 11 | # User-friendly check for sphinx-build 12 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 13 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 14 | endif 15 | 16 | # Internal variables. 17 | PAPEROPT_a4 = -D latex_paper_size=a4 18 | PAPEROPT_letter = -D latex_paper_size=letter 19 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 20 | # the i18n builder cannot share the environment and doctrees with the others 21 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 22 | 23 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext 24 | 25 | help: 26 | @echo "Please use \`make ' where is one of" 27 | @echo " livehtml to make standalone HTML files, served on port 8000" 28 | @echo " html to make standalone HTML files" 29 | @echo " dirhtml to make HTML files named index.html in directories" 30 | @echo " singlehtml to make a single large HTML file" 31 | @echo " pickle to make pickle files" 32 | @echo " json to make JSON files" 33 | @echo " htmlhelp to make HTML files and a HTML help project" 34 | @echo " qthelp to make HTML files and a qthelp project" 35 | @echo " applehelp to make an Apple Help Book" 36 | @echo " devhelp to make HTML files and a Devhelp project" 37 | @echo " epub to make an epub" 38 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 39 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 40 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 41 | @echo " text to make text files" 42 | @echo " man to make manual pages" 43 | @echo " texinfo to make Texinfo files" 44 | @echo " info to make Texinfo files and run them through makeinfo" 45 | @echo " gettext to make PO message catalogs" 46 | @echo " changes to make an overview of all changed/added/deprecated items" 47 | @echo " xml to make Docutils-native XML files" 48 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 49 | @echo " linkcheck to check all external links for integrity" 50 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 51 | @echo " coverage to run coverage check of the documentation (if enabled)" 52 | 53 | clean: 54 | rm -rf $(BUILDDIR)/* 55 | 56 | livehtml: 57 | $(SPHINXAUTOBUILD) -b html --ignore *___jb_* $(ALLSPHINXOPTS) $(BUILDDIR)/html 58 | @echo 59 | 60 | html: 61 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 62 | @echo 63 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 64 | 65 | dirhtml: 66 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 67 | @echo 68 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 69 | 70 | singlehtml: 71 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 72 | @echo 73 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 74 | 75 | pickle: 76 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 77 | @echo 78 | @echo "Build finished; now you can process the pickle files." 79 | 80 | json: 81 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 82 | @echo 83 | @echo "Build finished; now you can process the JSON files." 84 | 85 | htmlhelp: 86 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 87 | @echo 88 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 89 | ".hhp project file in $(BUILDDIR)/htmlhelp." 90 | 91 | qthelp: 92 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 93 | @echo 94 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 95 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 96 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/AnsibleJenkinsDevOpsRoles.qhcp" 97 | @echo "To view the help file:" 98 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/AnsibleJenkinsDevOpsRoles.qhc" 99 | 100 | applehelp: 101 | $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp 102 | @echo 103 | @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." 104 | @echo "N.B. You won't be able to view it unless you put it in" \ 105 | "~/Library/Documentation/Help or install it in your application" \ 106 | "bundle." 107 | 108 | devhelp: 109 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 110 | @echo 111 | @echo "Build finished." 112 | @echo "To view the help file:" 113 | @echo "# mkdir -p $$HOME/.local/share/devhelp/AnsibleJenkinsDevOpsRoles" 114 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/AnsibleJenkinsDevOpsRoles" 115 | @echo "# devhelp" 116 | 117 | epub: 118 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 119 | @echo 120 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 121 | 122 | latex: 123 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 124 | @echo 125 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 126 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 127 | "(use \`make latexpdf' here to do that automatically)." 128 | 129 | latexpdf: 130 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 131 | @echo "Running LaTeX files through pdflatex..." 132 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 133 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 134 | 135 | latexpdfja: 136 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 137 | @echo "Running LaTeX files through platex and dvipdfmx..." 138 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 139 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 140 | 141 | text: 142 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 143 | @echo 144 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 145 | 146 | man: 147 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 148 | @echo 149 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 150 | 151 | texinfo: 152 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 153 | @echo 154 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 155 | @echo "Run \`make' in that directory to run these through makeinfo" \ 156 | "(use \`make info' here to do that automatically)." 157 | 158 | info: 159 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 160 | @echo "Running Texinfo files through makeinfo..." 161 | make -C $(BUILDDIR)/texinfo info 162 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 163 | 164 | gettext: 165 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 166 | @echo 167 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 168 | 169 | changes: 170 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 171 | @echo 172 | @echo "The overview file is in $(BUILDDIR)/changes." 173 | 174 | linkcheck: 175 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 176 | @echo 177 | @echo "Link check complete; look for any errors in the above output " \ 178 | "or in $(BUILDDIR)/linkcheck/output.txt." 179 | 180 | doctest: 181 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 182 | @echo "Testing of doctests in the sources finished, look at the " \ 183 | "results in $(BUILDDIR)/doctest/output.txt." 184 | 185 | coverage: 186 | $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage 187 | @echo "Testing of coverage in the sources finished, look at the " \ 188 | "results in $(BUILDDIR)/coverage/python.txt." 189 | 190 | xml: 191 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 192 | @echo 193 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 194 | 195 | pseudoxml: 196 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 197 | @echo 198 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 199 | -------------------------------------------------------------------------------- /doc/_references.txt: -------------------------------------------------------------------------------- 1 | .. _Michael Jansen: http://michael-jansen.biz 2 | .. _Read The Docs: http://ansible-jenkins-roles.readthedocs.org/en/latest/ 3 | .. _ansible: http://ansible.com 4 | .. _apache tomcat: https://tomcat.apache.org/ 5 | .. _examples repo: https://github.com/jansenm/ansible-jenkins-roles-example 6 | .. _jenkins: http://jenkins-ci.org 7 | .. _job-dsl plugin: https://github.com/jenkinsci/job-dsl-plugin 8 | 9 | -------------------------------------------------------------------------------- /doc/ansible/__init__.py: -------------------------------------------------------------------------------- 1 | import docutils 2 | import docutils.nodes 3 | import docutils.parsers.rst 4 | import docutils.parsers.rst.directives 5 | import sphinx.addnodes 6 | import sphinx.application 7 | import sphinx.directives 8 | import sphinx.domains 9 | import sphinx.environment 10 | import sphinx.locale 11 | import sphinx.roles 12 | import sphinx.util.compat 13 | import sphinx.util.docfields 14 | import sphinx.util.nodes 15 | 16 | 17 | class AnsibleRoleRole(sphinx.roles.XRefRole): 18 | def process_link(self, env, refnode, has_explicit_title, title, target): 19 | return title, target 20 | 21 | 22 | class AnsibleRoleDirective(sphinx.directives.ObjectDescription): 23 | # :BUG: Something is wrong (just a test) 24 | 25 | required_arguments = 1 26 | 27 | doc_field_types = [ 28 | sphinx.util.docfields.GroupedField( 29 | 'default', 30 | label=sphinx.locale.l_('Defaults'), 31 | names=('default', 'default') 32 | ), 33 | sphinx.util.docfields.Field( 34 | 'dependency', 35 | label=sphinx.locale.l_('Dependencies'), 36 | names=('dependency', 'depend'), 37 | rolename='role', 38 | bodyrolename='role' 39 | ), 40 | sphinx.util.docfields.TypedField( 41 | 'parameter', 42 | label=sphinx.locale.l_('Parameters'), 43 | names=('param', 'parameter', 'arg', 'argument'), 44 | typerolename='role', 45 | typenames=('type',) 46 | ), 47 | sphinx.util.docfields.Field( 48 | 'become', 49 | label=sphinx.locale.l_('Uses become'), 50 | names=('become') 51 | ) 52 | ] 53 | 54 | option_spec = { 55 | 'noindex': docutils.parsers.rst.directives.flag 56 | } 57 | 58 | has_content = True 59 | 60 | def handle_signature(self, sig: str, signode: sphinx.addnodes.desc_signature): 61 | (ns, _, rolename) = sig.rpartition('/') 62 | signode += sphinx.addnodes.desc_annotation('role', 'Role ') 63 | signode += sphinx.addnodes.desc_addname(ns, "{ns} ".format(ns=ns)) 64 | signode += sphinx.addnodes.desc_name(rolename, rolename) 65 | return 'role-' + sig 66 | 67 | def add_target_and_index(self, name, sig, signode): 68 | targetname = name 69 | signode['ids'].append(targetname) 70 | self.env.domaindata['ansible']['roles'][name] = (self.env.docname, name) 71 | self.state.document.note_explicit_target(signode) 72 | 73 | 74 | class AnsibleDomain(sphinx.domains.Domain): 75 | """Ansible domain""" 76 | 77 | name = "ansible" 78 | 79 | label = "Ansible" 80 | 81 | object_types = { 82 | 'role': sphinx.domains.ObjType(sphinx.locale.l_('role'), 'role') 83 | } 84 | 85 | directives = { 86 | 'role': AnsibleRoleDirective 87 | } 88 | 89 | roles = { 90 | 'role': AnsibleRoleRole() 91 | } 92 | 93 | initial_data = { 94 | "roles": {} 95 | } 96 | 97 | def clear_doc(self, doc): 98 | for name in self.data['roles']: 99 | if doc == self.data['roles'][name][1]: 100 | del self.data['roles'][name] 101 | 102 | def get_objects(self): 103 | for docname, name in self.data['roles'].values(): 104 | yield name, name, 'role', docname, 'role-' + name, 1 105 | 106 | def resolve_xref(self, env, fromdocname, builder, 107 | type, target, node, contnode): 108 | 109 | print(target) 110 | if (type == "role"): 111 | for (docname, name) in self.data['roles'].values(): 112 | if name == target: 113 | print("Yes") 114 | return sphinx.util.nodes.make_refnode( 115 | builder, 116 | fromdocname, 117 | docname, 118 | name, 119 | contnode 120 | ) 121 | else: 122 | # print("here") 123 | # print(node) 124 | # print(contnode) 125 | # print(type) 126 | # print(target) 127 | # print(builder) 128 | # print(fromdocname) 129 | # print(env) 130 | return 131 | 132 | def resolve_any_xref(self, env, fromdocname, builder, 133 | type, target, node, contnode): 134 | 135 | print("resolve_xref") 136 | print(type) 137 | print(target) 138 | 139 | 140 | def setup(app: sphinx.application.Sphinx): 141 | """Initialize the sphinx extension for ansible. 142 | """ 143 | app.add_domain(AnsibleDomain) 144 | -------------------------------------------------------------------------------- /doc/coding_standards.rst: -------------------------------------------------------------------------------- 1 | Coding Standards 2 | ================ 3 | 4 | Global Variables 5 | **************** 6 | 7 | install_prefix 8 | Installation prefix to use for software. The default value is `/opt` 9 | 10 | It should be used for all *optional* software not installed using the default distribution 11 | package manager. It should not be used directly but used to define a role default installation 12 | prefix to allow fine grained control of the installation directory. Eg:: 13 | 14 | jenkins_prefix: "{{install_prefix}}/jenkins-ci" 15 | 16 | Remember to use software specifx names for the prefix var if applicable (eg. java_home, catalina_home). 17 | 18 | cache_directory 19 | Base directory of the local artefact cache. See `artefact cache`_ 20 | 21 | .. _artefact cache: 22 | 23 | Roles 24 | ***** 25 | 26 | Role Variables 27 | -------------- 28 | 29 | All role arguments should be documented in `role/vars/main.yml`. But we have to keep in mind that variables set 30 | there have very high precedence. So the distinction between role argument and role default has to be done very 31 | carefully. 32 | 33 | Role Arguments 34 | Role arguments are hard to override. Starting with version 2.0 `ansible variable precedence`_ is more clearly 35 | defined and tells us that role variables are only second to 36 | 37 | - **role and include vars** 38 | - block vars (only for tasks in block) 39 | - task vars (only for the task) 40 | - extra vars 41 | 42 | Role Defaults 43 | Role defaults lose out to all other kind of variables. Because of this they should be named carefully to minimize 44 | the change for an accidently override. They should be prefix by role name (including any directory parts) joined 45 | by undescore. 46 | 47 | .. code:: yaml 48 | 49 | # java/lang/oracle-sdk/defaults.yml 50 | java_lang_oracle_sdk_default_version_8: 8.0.65 51 | 52 | Become User 53 | ----------- 54 | 55 | The `become user (aka sudo or su)` feature is forbidden in roles. Every role has to work without sudo rights for the 56 | installation user. 57 | 58 | The rationale for this is that the role designer has no idea if all of his users have the possibility to use sudo on 59 | their machines. This information is only available to the playbook/play designer. A role should clearly document its 60 | requirements and thats it. 61 | 62 | A role to install apache tomcat should NOT 63 | 64 | - Create a tomcat user on the system 65 | - Create a directory /srv/tomcat on the system as root 66 | 67 | Instead it should document that 68 | 69 | - it takes a parameter catalina_base and it needs the rights to create that directory/write to it. The playbook 70 | designer then has to make sure thats true. Either by creating a tomcat user and that directory in the playbook or by 71 | having the system administrators do it. 72 | 73 | .. IMPORTANT:: 74 | 75 | A role that installs tomcat AND creates all desired users/groups/directories utilizing become_user is unusable in 76 | environments where sudo is not allowed (companies, hosted servers). The role therefore is NOT reusable in those 77 | environments and that equals wasted effort maintaining two roles. 78 | 79 | A role should only do ONE thing. Playbooks/plays are responsible to chain roles together. 80 | 81 | Artefact Cache 82 | -------------- 83 | 84 | To make offline usage possible all artefacts acquired from external resources should be cached locally. A global 85 | variable is available to use for the location:: 86 | 87 | jenkins_cache: "{{cache_directory}}/jenkins-ci 88 | 89 | 90 | 91 | .. _ansible variable precedence: http://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable 92 | -------------------------------------------------------------------------------- /doc/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Ansible Jenkins DevOps Roles documentation build configuration file, created by 5 | # sphinx-quickstart on Sat Dec 26 19:55:10 2015. 6 | # 7 | # This file is execfile()d with the current directory set to its 8 | # containing dir. 9 | # 10 | # Note that not all possible configuration values are present in this 11 | # autogenerated file. 12 | # 13 | # All configuration values have a default; values that are commented out 14 | # serve to show the default. 15 | 16 | import sys 17 | import os 18 | import shlex 19 | 20 | # If extensions (or modules to document with autodoc) are in another directory, 21 | # add these directories to sys.path here. If the directory is relative to the 22 | # documentation root, use os.path.abspath to make it absolute, like shown here. 23 | sys.path.insert(0, os.path.abspath('.')) 24 | 25 | # -- General configuration ------------------------------------------------ 26 | 27 | # If your documentation needs a minimal Sphinx version, state it here. 28 | #needs_sphinx = '1.0' 29 | 30 | # Add any Sphinx extension module names here, as strings. They can be 31 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 32 | # ones. 33 | extensions = [ 34 | 'sphinx.ext.todo', 35 | 'ansible' 36 | ] 37 | 38 | # Add any paths that contain templates here, relative to this directory. 39 | templates_path = ['_templates'] 40 | 41 | # The suffix(es) of source filenames. 42 | # You can specify multiple suffix as a list of string: 43 | # source_suffix = ['.rst', '.md'] 44 | source_suffix = '.rst' 45 | 46 | # The encoding of source files. 47 | #source_encoding = 'utf-8-sig' 48 | 49 | # The master toctree document. 50 | master_doc = 'index' 51 | 52 | # General information about the project. 53 | project = 'Ansible Jenkins DevOps Roles' 54 | copyright = '2015, Michael Jansen' 55 | author = 'Michael Jansen' 56 | 57 | # The version info for the project you're documenting, acts as replacement for 58 | # |version| and |release|, also used in various other places throughout the 59 | # built documents. 60 | # 61 | # The short X.Y version. 62 | version = '0.0.1' 63 | # The full version, including alpha/beta/rc tags. 64 | release = '0.0.1' 65 | 66 | # The language for content autogenerated by Sphinx. Refer to documentation 67 | # for a list of supported languages. 68 | # 69 | # This is also used if you do content translation via gettext catalogs. 70 | # Usually you set "language" from the command line for these cases. 71 | language = None 72 | 73 | # There are two options for replacing |today|: either, you set today to some 74 | # non-false value, then it is used: 75 | #today = '' 76 | # Else, today_fmt is used as the format for a strftime call. 77 | #today_fmt = '%B %d, %Y' 78 | 79 | # List of patterns, relative to source directory, that match files and 80 | # directories to ignore when looking for source files. 81 | exclude_patterns = ['_build'] 82 | 83 | # The reST default role (used for this markup: `text`) to use for all 84 | # documents. 85 | #default_role = None 86 | 87 | # If true, '()' will be appended to :func: etc. cross-reference text. 88 | #add_function_parentheses = True 89 | 90 | # If true, the current module name will be prepended to all description 91 | # unit titles (such as .. function::). 92 | #add_module_names = True 93 | 94 | # If true, sectionauthor and moduleauthor directives will be shown in the 95 | # output. They are ignored by default. 96 | #show_authors = False 97 | 98 | # The name of the Pygments (syntax highlighting) style to use. 99 | pygments_style = 'sphinx' 100 | 101 | # A list of ignored prefixes for module index sorting. 102 | #modindex_common_prefix = [] 103 | 104 | # If true, keep warnings as "system message" paragraphs in the built documents. 105 | #keep_warnings = False 106 | 107 | # If true, `todo` and `todoList` produce output, else they produce nothing. 108 | todo_include_todos = True 109 | 110 | 111 | # -- Options for HTML output ---------------------------------------------- 112 | 113 | # The theme to use for HTML and HTML Help pages. See the documentation for 114 | # a list of builtin themes. 115 | html_theme = 'sphinx_rtd_theme' 116 | 117 | # Theme options are theme-specific and customize the look and feel of a theme 118 | # further. For a list of options available for each theme, see the 119 | # documentation. 120 | #html_theme_options = {} 121 | 122 | # Add any paths that contain custom themes here, relative to this directory. 123 | #html_theme_path = [] 124 | 125 | # The name for this set of Sphinx documents. If None, it defaults to 126 | # " v documentation". 127 | #html_title = None 128 | 129 | # A shorter title for the navigation bar. Default is the same as html_title. 130 | #html_short_title = None 131 | 132 | # The name of an image file (relative to this directory) to place at the top 133 | # of the sidebar. 134 | #html_logo = None 135 | 136 | # The name of an image file (within the static path) to use as favicon of the 137 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 138 | # pixels large. 139 | #html_favicon = None 140 | 141 | # Add any paths that contain custom static files (such as style sheets) here, 142 | # relative to this directory. They are copied after the builtin static files, 143 | # so a file named "default.css" will overwrite the builtin "default.css". 144 | html_static_path = ['_static'] 145 | 146 | # Add any extra paths that contain custom files (such as robots.txt or 147 | # .htaccess) here, relative to this directory. These files are copied 148 | # directly to the root of the documentation. 149 | #html_extra_path = [] 150 | 151 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 152 | # using the given strftime format. 153 | #html_last_updated_fmt = '%b %d, %Y' 154 | 155 | # If true, SmartyPants will be used to convert quotes and dashes to 156 | # typographically correct entities. 157 | #html_use_smartypants = True 158 | 159 | # Custom sidebar templates, maps document names to template names. 160 | #html_sidebars = {} 161 | 162 | # Additional templates that should be rendered to pages, maps page names to 163 | # template names. 164 | #html_additional_pages = {} 165 | 166 | # If false, no module index is generated. 167 | #html_domain_indices = True 168 | 169 | # If false, no index is generated. 170 | #html_use_index = True 171 | 172 | # If true, the index is split into individual pages for each letter. 173 | #html_split_index = False 174 | 175 | # If true, links to the reST sources are added to the pages. 176 | #html_show_sourcelink = True 177 | 178 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 179 | #html_show_sphinx = True 180 | 181 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 182 | #html_show_copyright = True 183 | 184 | # If true, an OpenSearch description file will be output, and all pages will 185 | # contain a tag referring to it. The value of this option must be the 186 | # base URL from which the finished HTML is served. 187 | #html_use_opensearch = '' 188 | 189 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 190 | #html_file_suffix = None 191 | 192 | # Language to be used for generating the HTML full-text search index. 193 | # Sphinx supports the following languages: 194 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' 195 | # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr' 196 | #html_search_language = 'en' 197 | 198 | # A dictionary with options for the search language support, empty by default. 199 | # Now only 'ja' uses this config value 200 | #html_search_options = {'type': 'default'} 201 | 202 | # The name of a javascript file (relative to the configuration directory) that 203 | # implements a search results scorer. If empty, the default will be used. 204 | #html_search_scorer = 'scorer.js' 205 | 206 | # Output file base name for HTML help builder. 207 | htmlhelp_basename = 'AnsibleJenkinsDevOpsRolesdoc' 208 | 209 | # -- Options for LaTeX output --------------------------------------------- 210 | 211 | latex_elements = { 212 | # The paper size ('letterpaper' or 'a4paper'). 213 | #'papersize': 'letterpaper', 214 | 215 | # The font size ('10pt', '11pt' or '12pt'). 216 | #'pointsize': '10pt', 217 | 218 | # Additional stuff for the LaTeX preamble. 219 | #'preamble': '', 220 | 221 | # Latex figure (float) alignment 222 | #'figure_align': 'htbp', 223 | } 224 | 225 | # Grouping the document tree into LaTeX files. List of tuples 226 | # (source start file, target name, title, 227 | # author, documentclass [howto, manual, or own class]). 228 | latex_documents = [ 229 | (master_doc, 'AnsibleJenkinsDevOpsRoles.tex', 'Ansible Jenkins DevOps Roles Documentation', 230 | 'Michael Jansen', 'manual'), 231 | ] 232 | 233 | # The name of an image file (relative to this directory) to place at the top of 234 | # the title page. 235 | #latex_logo = None 236 | 237 | # For "manual" documents, if this is true, then toplevel headings are parts, 238 | # not chapters. 239 | #latex_use_parts = False 240 | 241 | # If true, show page references after internal links. 242 | #latex_show_pagerefs = False 243 | 244 | # If true, show URL addresses after external links. 245 | #latex_show_urls = False 246 | 247 | # Documents to append as an appendix to all manuals. 248 | #latex_appendices = [] 249 | 250 | # If false, no module index is generated. 251 | #latex_domain_indices = True 252 | 253 | 254 | # -- Options for manual page output --------------------------------------- 255 | 256 | # One entry per manual page. List of tuples 257 | # (source start file, name, description, authors, manual section). 258 | man_pages = [ 259 | (master_doc, 'ansiblejenkinsdevopsroles', 'Ansible Jenkins DevOps Roles Documentation', 260 | [author], 1) 261 | ] 262 | 263 | # If true, show URL addresses after external links. 264 | #man_show_urls = False 265 | 266 | 267 | # -- Options for Texinfo output ------------------------------------------- 268 | 269 | # Grouping the document tree into Texinfo files. List of tuples 270 | # (source start file, target name, title, author, 271 | # dir menu entry, description, category) 272 | texinfo_documents = [ 273 | (master_doc, 'AnsibleJenkinsDevOpsRoles', 'Ansible Jenkins DevOps Roles Documentation', 274 | author, 'AnsibleJenkinsDevOpsRoles', 'One line description of project.', 275 | 'Miscellaneous'), 276 | ] 277 | 278 | # Documents to append as an appendix to all manuals. 279 | #texinfo_appendices = [] 280 | 281 | # If false, no module index is generated. 282 | #texinfo_domain_indices = True 283 | 284 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 285 | #texinfo_show_urls = 'footnote' 286 | 287 | # If true, do not generate a @detailmenu in the "Top" node's menu. 288 | #texinfo_no_detailmenu = False 289 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. Ansible Jenkins DevOps Roles documentation master file, created by 2 | sphinx-quickstart on Sat Dec 26 19:55:10 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Ansible Jenkins DevOps Roles's documentation! 7 | ======================================================== 8 | 9 | This is not a turn-key solution to install `jenkins`_. Its a set of roles to tailor yourself a running jenkins that is 10 | immediately useful without any manual touch. But you need to write your playbook yourself. 11 | 12 | The following rules were applied when writing those roles. 13 | 14 | Contents: 15 | 16 | .. toctree:: 17 | :maxdepth: 2 18 | :glob: 19 | 20 | Home 21 | coding_standards 22 | roles/* 23 | 24 | Indices and tables 25 | ================== 26 | 27 | * :ref:`genindex` 28 | * :ref:`search` 29 | 30 | 31 | .. _jenkins: http://jenkins-ci.org 32 | 33 | -------------------------------------------------------------------------------- /doc/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=_build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 10 | set I18NSPHINXOPTS=%SPHINXOPTS% . 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. xml to make Docutils-native XML files 37 | echo. pseudoxml to make pseudoxml-XML files for display purposes 38 | echo. linkcheck to check all external links for integrity 39 | echo. doctest to run all doctests embedded in the documentation if enabled 40 | echo. coverage to run coverage check of the documentation if enabled 41 | goto end 42 | ) 43 | 44 | if "%1" == "clean" ( 45 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 46 | del /q /s %BUILDDIR%\* 47 | goto end 48 | ) 49 | 50 | 51 | REM Check if sphinx-build is available and fallback to Python version if any 52 | %SPHINXBUILD% 1>NUL 2>NUL 53 | if errorlevel 9009 goto sphinx_python 54 | goto sphinx_ok 55 | 56 | :sphinx_python 57 | 58 | set SPHINXBUILD=python -m sphinx.__init__ 59 | %SPHINXBUILD% 2> nul 60 | if errorlevel 9009 ( 61 | echo. 62 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 63 | echo.installed, then set the SPHINXBUILD environment variable to point 64 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 65 | echo.may add the Sphinx directory to PATH. 66 | echo. 67 | echo.If you don't have Sphinx installed, grab it from 68 | echo.http://sphinx-doc.org/ 69 | exit /b 1 70 | ) 71 | 72 | :sphinx_ok 73 | 74 | 75 | if "%1" == "html" ( 76 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 77 | if errorlevel 1 exit /b 1 78 | echo. 79 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 80 | goto end 81 | ) 82 | 83 | if "%1" == "dirhtml" ( 84 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 85 | if errorlevel 1 exit /b 1 86 | echo. 87 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 88 | goto end 89 | ) 90 | 91 | if "%1" == "singlehtml" ( 92 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 93 | if errorlevel 1 exit /b 1 94 | echo. 95 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 96 | goto end 97 | ) 98 | 99 | if "%1" == "pickle" ( 100 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 101 | if errorlevel 1 exit /b 1 102 | echo. 103 | echo.Build finished; now you can process the pickle files. 104 | goto end 105 | ) 106 | 107 | if "%1" == "json" ( 108 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 109 | if errorlevel 1 exit /b 1 110 | echo. 111 | echo.Build finished; now you can process the JSON files. 112 | goto end 113 | ) 114 | 115 | if "%1" == "htmlhelp" ( 116 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 117 | if errorlevel 1 exit /b 1 118 | echo. 119 | echo.Build finished; now you can run HTML Help Workshop with the ^ 120 | .hhp project file in %BUILDDIR%/htmlhelp. 121 | goto end 122 | ) 123 | 124 | if "%1" == "qthelp" ( 125 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 129 | .qhcp project file in %BUILDDIR%/qthelp, like this: 130 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\AnsibleJenkinsDevOpsRoles.qhcp 131 | echo.To view the help file: 132 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\AnsibleJenkinsDevOpsRoles.ghc 133 | goto end 134 | ) 135 | 136 | if "%1" == "devhelp" ( 137 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 138 | if errorlevel 1 exit /b 1 139 | echo. 140 | echo.Build finished. 141 | goto end 142 | ) 143 | 144 | if "%1" == "epub" ( 145 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 146 | if errorlevel 1 exit /b 1 147 | echo. 148 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 149 | goto end 150 | ) 151 | 152 | if "%1" == "latex" ( 153 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 154 | if errorlevel 1 exit /b 1 155 | echo. 156 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 157 | goto end 158 | ) 159 | 160 | if "%1" == "latexpdf" ( 161 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 162 | cd %BUILDDIR%/latex 163 | make all-pdf 164 | cd %~dp0 165 | echo. 166 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 167 | goto end 168 | ) 169 | 170 | if "%1" == "latexpdfja" ( 171 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 172 | cd %BUILDDIR%/latex 173 | make all-pdf-ja 174 | cd %~dp0 175 | echo. 176 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 177 | goto end 178 | ) 179 | 180 | if "%1" == "text" ( 181 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 182 | if errorlevel 1 exit /b 1 183 | echo. 184 | echo.Build finished. The text files are in %BUILDDIR%/text. 185 | goto end 186 | ) 187 | 188 | if "%1" == "man" ( 189 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 190 | if errorlevel 1 exit /b 1 191 | echo. 192 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 193 | goto end 194 | ) 195 | 196 | if "%1" == "texinfo" ( 197 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 198 | if errorlevel 1 exit /b 1 199 | echo. 200 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 201 | goto end 202 | ) 203 | 204 | if "%1" == "gettext" ( 205 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 206 | if errorlevel 1 exit /b 1 207 | echo. 208 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 209 | goto end 210 | ) 211 | 212 | if "%1" == "changes" ( 213 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 214 | if errorlevel 1 exit /b 1 215 | echo. 216 | echo.The overview file is in %BUILDDIR%/changes. 217 | goto end 218 | ) 219 | 220 | if "%1" == "linkcheck" ( 221 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 222 | if errorlevel 1 exit /b 1 223 | echo. 224 | echo.Link check complete; look for any errors in the above output ^ 225 | or in %BUILDDIR%/linkcheck/output.txt. 226 | goto end 227 | ) 228 | 229 | if "%1" == "doctest" ( 230 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 231 | if errorlevel 1 exit /b 1 232 | echo. 233 | echo.Testing of doctests in the sources finished, look at the ^ 234 | results in %BUILDDIR%/doctest/output.txt. 235 | goto end 236 | ) 237 | 238 | if "%1" == "coverage" ( 239 | %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage 240 | if errorlevel 1 exit /b 1 241 | echo. 242 | echo.Testing of coverage in the sources finished, look at the ^ 243 | results in %BUILDDIR%/coverage/python.txt. 244 | goto end 245 | ) 246 | 247 | if "%1" == "xml" ( 248 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml 249 | if errorlevel 1 exit /b 1 250 | echo. 251 | echo.Build finished. The XML files are in %BUILDDIR%/xml. 252 | goto end 253 | ) 254 | 255 | if "%1" == "pseudoxml" ( 256 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml 257 | if errorlevel 1 exit /b 1 258 | echo. 259 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. 260 | goto end 261 | ) 262 | 263 | :end 264 | -------------------------------------------------------------------------------- /doc/roles/apache-tomcat-8/configuration-copy.rst: -------------------------------------------------------------------------------- 1 | Role apache/tomcat-8/configuration-copy 2 | ======================================= 3 | 4 | Copy a custom tomcat configuration into `CATALINA_BASE`. 5 | 6 | .. ansible:role:: apache/tomcat-8/configuration-copy 7 | 8 | :become: No 9 | 10 | :dependency: apache/tomcat-defaults 11 | 12 | :param catalina_home: The apache tomcat install to use. 13 | :param configuration: Directory with the custom tomcat configuration. 14 | 15 | This copies the content of +configuration+ into the tomcat instances `conf` directory. 16 | -------------------------------------------------------------------------------- /doc/roles/apache-tomcat-8/configuration-defaults.rst: -------------------------------------------------------------------------------- 1 | Role apache/tomcat-8/configuration-default 2 | ========================================== 3 | 4 | Copy the tomcat default configuration into `CATALINA_BASE`. 5 | 6 | .. ansible:role:: apache/tomcat-8/configuration-default 7 | 8 | :become: No 9 | 10 | :dependency: apache/tomcat-defaults 11 | 12 | :param catalina_base: Base directory of the new tomcat instance. 13 | :param catalina_home: The apache tomcat install to use. 14 | 15 | This copies the conf/ directory from the tomcat archive into the instance/ 16 | 17 | -------------------------------------------------------------------------------- /doc/roles/apache-tomcat-8/install.rst: -------------------------------------------------------------------------------- 1 | Role apache/tomcat-8/install 2 | ============================ 3 | 4 | Download and install tomcat 8. 5 | 6 | The *prefix* directory needs to exist and writable. 7 | 8 | .. note:: 9 | This does not create a running tomcat instance. It downloads and copies the archive to the host. To create 10 | a instance see :ansible:role:`role-apache/tomcat-8-instance`. 11 | 12 | .. ansible:role:: apache/tomcat-8-install 13 | 14 | :become: No 15 | :dependency: apache/tomcat-defaults 16 | 17 | :param version: Tomcat version to install (eg. 8.0.29) 18 | :param checksum: Checksum for the tomcat archive (eg. 4b7ba7a5af0a5c395c0740fc011b59d1) 19 | :param prefix: Install prefix (default: :file:`{{apache_tomcat_prefix}}`). 20 | 21 | -------------------------------------------------------------------------------- /doc/roles/apache-tomcat-8/instance.rst: -------------------------------------------------------------------------------- 1 | Role apache/tomcat-8/instance 2 | ============================= 3 | 4 | Create a tomcat 8 instance. 5 | 6 | .. ansible:role:: apache/tomcat-8-instance 7 | 8 | :become: No 9 | :dependency: apache/tomcat-defaults 10 | 11 | :default apache_tomcat_8_default_version: 12 | Default tomcat version to install (default: unset) 13 | :default apache_tomcat_8_instance_catalina_home: 14 | Default `CATALINA_HOME` to use for instance setup (default: 15 | `{{apache_tomcat_prefix}}/apache-tomcat-{{tomcat_version|default(apache_tomcat_8_default_version)}}`) 16 | :default apache_tomcat_8_instance_manager_apps: 17 | Default tomcat webapps to activate for the instance (default: all - see below) 18 | :default apache_tomcat_8_java_opts: 19 | Default options for the jvm 20 | :param manager_apps: 21 | Default tomcat webapp to activate for the instance (default: `"{{apache_tomcat_8_instance_manager_apps}}"` 22 | :param catalina_base: Base directory of the new tomcat instance. 23 | :param catalina_home: The apache tomcat install to use. 24 | :param java_home: Java installation to use for running tomcat. 25 | :param java_opts: Options for the jvm. 26 | :param server_port: Server port (default: `{{apache_tomcat_server_port}}`). 27 | :param http_connector_port: Http connector port (default: `{{apache_tomcat_http_connector_port}}`). 28 | :param ajp_connector_port: Ajp connector port (default: `{{apache_tomcat_ajp_connector_port}}`). 29 | :param cache_directory: Where to cache downloaded artifacts for future reuse on play host. 30 | 31 | 32 | Configuration 33 | ------------- 34 | 35 | This creates a tomcat instance with an empty `conf/` directory. The next step is to add some configuration. As there 36 | is no common tomcat configuration that fits all use cases its your responsibility to fill in the configuration 37 | according to your needs. 38 | 39 | The role :ansible:role:`role-apache/tomcat-8/configuration-default` copies the default tomcat configuration which is 40 | **NOT SUITED FOR PRODUCTION USE**. Its only provided for convenience in development setups. 41 | 42 | The role :ansible:role:`role-apache/tomcat-8/configuration-copy` can be used to copy a complete directory into 43 | `conf/. 44 | 45 | 46 | Default Applications 47 | -------------------- 48 | 49 | Tomcats comes with the following web applications 50 | 51 | - "host-manager" 52 | - "manager" 53 | - "ROOT" 54 | - "examples" 55 | - "docs" 56 | 57 | -------------------------------------------------------------------------------- /doc/roles/apache-tomcat.rst: -------------------------------------------------------------------------------- 1 | Apache Tomcat 2 | ============= 3 | 4 | Roles to download install and configure `apache tomcat`_. 5 | 6 | The setup implemented is the one described in `tomcat advanced configuration`_. One installation of the tomcat release 7 | can power multiple tomcat instances. 8 | 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | :glob: 13 | 14 | apache-tomcat/* 15 | apache-tomcat-8/* 16 | 17 | 18 | .. include:: ../_references.txt 19 | .. _tomcat advanced configuration: https://tomcat.apache.org/tomcat-8.0-doc/RUNNING.txt 20 | -------------------------------------------------------------------------------- /doc/roles/apache-tomcat/defaults.rst: -------------------------------------------------------------------------------- 1 | Role apache/tomcat/defaults 2 | =========================== 3 | 4 | A convenience role that provides some common defaults for all tomcat related roles. 5 | 6 | You should not need to call it directly unless you implement a tomcat role. 7 | 8 | .. ansible:role:: apache/tomcat-defaults 9 | 10 | :become: No 11 | 12 | :default apache_tomcat_download_server: Mirror to download from (default: "http://mirror.synyx.de/apache/tomcat") 13 | :default apache_tomcat_prefix: Default installation prefix (default: :file:`{{install_prefix}}/apache-tomcat`). 14 | :default apache_tomcat_server_port: Tomcat server port (default: 8005). 15 | :default apache_tomcat_http_connector_port: The nopn-ssl/tls http/1.1 connector port (default: 8080). 16 | :default apache_tomcat_ajp_connector_port: The ajp connector port (default: 8009). 17 | -------------------------------------------------------------------------------- /doc/roles/jenkins.rst: -------------------------------------------------------------------------------- 1 | Jenkins 2 | ======= 3 | 4 | Roles to deploy and configure `jenkins`_. 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | :glob: 9 | 10 | jenkins/* 11 | 12 | -------------------------------------------------------------------------------- /doc/roles/jenkins/bootstrap-job.rst: -------------------------------------------------------------------------------- 1 | Role jenkins/bootstrap-job 2 | ========================== 3 | 4 | Install a bootstrap job into jenkins 5 | 6 | A bootstrap job will be created that checks out from a :abbr:`vcs(version control system)` and then executes all scripts 7 | that match the file glob `bootstrap/*.job` as a job-dsl script. This naturally assumes the `job-dsl plugin`_ is 8 | installed and ready. 9 | 10 | Currently only git is supported but adding support for other vcs is a simple matter. 11 | 12 | .. ansible:role:: jenkins/bootstrap-job 13 | 14 | :become: No 15 | 16 | :param jenkins_home: Jenkins instance home. 17 | :param git_repo: Git repository with job-dsl scripts to bootstrap the jenkins instance. 18 | :param git_branch: Branch to checkout from git_repository (default: master) 19 | 20 | 21 | .. include:: ../../_references.txt 22 | 23 | -------------------------------------------------------------------------------- /doc/roles/jenkins/configure-email-notification.rst: -------------------------------------------------------------------------------- 1 | Role jenkins/configure-email-notification 2 | ========================================= 3 | 4 | Configure the email notification part of the jenkins configuration. 5 | 6 | .. ansible:role:: jenkins/configure-email-notification 7 | 8 | :become: No 9 | 10 | :param jenkins_home: Jenkins instance home. 11 | :param smtp_host: SMTP host to configure. If undefined mailer is reset to null. 12 | :param smtp_port: SMTP port (default: 587). 13 | :param smtp_replyto: Sender email address. 14 | :param smtp_usessl: Use SSL for smtp connection? (default: false). 15 | :param smtp_user: Username for smtp authentication. This is optional. 16 | :param smtp_password: Password for smtp authentication. 17 | :param smtp_charset: Character set for emails (default: utf-8). 18 | 19 | If *smtp_host* is null then all other attributes are optional. 20 | 21 | If *smtp_host* is given then *smtp_replyto* is required too. 22 | 23 | If *smtp_username* is given then *smtp_password* is required too. 24 | 25 | Parameter *smtp_usessl* is about SSL not TLS! 26 | -------------------------------------------------------------------------------- /doc/roles/jenkins/configure-proxy.rst: -------------------------------------------------------------------------------- 1 | Role jenkins/configure-proxy 2 | ============================ 3 | 4 | Configure the proxy settings in jenkins. 5 | 6 | .. ansible:role:: jenkins/configure-proxy 7 | 8 | :become: No 9 | 10 | :param jenkins_home: Jenkins instance home. 11 | :param proxy_host: Proxy Hostname 12 | :param proxy_username: Username on proxy 13 | :param proxy_password: Password on proxy 14 | :param proxy_port: Proxy port 15 | :param proxy_noproxy: Use direct connections for these. One host per line. 16 | 17 | If *proxy_username* is defined *proxy_password* is required too. 18 | 19 | If *proxy_hostname* is defined *proxy_port* is required too. 20 | 21 | If *proxy_hostname* is undefined jenkins will be configured for direct connection. 22 | 23 | *no_proxy* is a list of newline separated hostnames. 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/roles/jenkins/configure.rst: -------------------------------------------------------------------------------- 1 | Role jenkins/configure 2 | ====================== 3 | 4 | Base configuration for jenkins. 5 | 6 | - Authentication 7 | - Authorization 8 | - Users 9 | - Admin email and url. 10 | 11 | .. ansible:role:: jenkins/configuration 12 | 13 | :become: No 14 | 15 | :default jenkins_default_authentication_strategy: 16 | Default authentication strategy (*hudson_private*) 17 | :default jenkins_default_authorization_strategy: 18 | Default authorization strategy (*project_matrix*) 19 | 20 | :param jenkins_home: Jenkins instance home. 21 | :param authentication_strategy: 22 | Authentication strategy to configure (default: *jenkins_default_authentication_strategy*) 23 | :param authorization_strategy: 24 | Authorization strategy to configure (default: *jenkins_default_authorization_strategy*) 25 | 26 | :param users: A list of users to create. Read the comments below. 27 | 28 | :param admin_email: Admin email address. 29 | :param url: Jenkins url. 30 | :param system_message: System message. (default: "Provisioned with ansible, all changes will be lost") 31 | :param number_of_executors: Number of executors (default: 2) 32 | :param node_mode: Node usage method. Valid values are "NORMAL" and "EXCLUSIVE" (default: "NORMAL") 33 | :param node_labels: Node labels as string. (default: "") 34 | 35 | 36 | **Authentication** 37 | 38 | Set *authentication_strategy* to one of the following values. 39 | 40 | Jenkins' own user database 41 | hudson_private 42 | Disable Security 43 | no_authentication 44 | LDAP 45 | not yet implemented 46 | Unix user/group database 47 | not yet implemented 48 | 49 | **Authorization** 50 | 51 | Set *authorization_strategy* to one of the following values. 52 | 53 | Anyone can do anything 54 | no_authorization 55 | Logged-in user can do anything 56 | full_control_once_logged_in 57 | Matrix-based security 58 | global_matrix 59 | Project-base Matrix Authorization Strategy 60 | project_matrix 61 | 62 | **Permissions** 63 | 64 | Jenkins permissions have string presentation. They consist of .. 65 | 66 | These are the group names for some permissions. The given category is from jenkins *Configure Global Sercurity* Page. 67 | To give a permission just append the permission to the group (eg. hudson.model.Hudson.Administer). In doubt 68 | configure the permission manually apply and check the :file:`jenkins/config.xml` file in :envvar:`JENKINS_HOME` 69 | 70 | Overall 71 | hudson.model.Hudson 72 | Credentials 73 | com.cloudbees.plugins.credentials.CredentialsProvider 74 | Slave 75 | hudson.model.Computer 76 | Job 77 | hudson.model.Item 78 | Run 79 | hudson.model.Run 80 | View 81 | hudson.model.View 82 | SCM 83 | hudson.scm.SCM 84 | 85 | **Users** 86 | 87 | If set *users* is expected to be a list of hashes to define the users to create. 88 | 89 | Only the authentication strategy *hudson_private* support creating users in jenkins. 90 | 91 | Only for authorization strategy *project_matrix* and *global_matrix* permissions are configurable. Authentication 92 | strategy does not matter for permissions. Unless its *no_authentication*. 93 | 94 | The password will never be changed if the user already exists. 95 | 96 | Example configuration: 97 | 98 | .. code-block:: yaml 99 | 100 | users: [ 101 | { 102 | id: 'admin', 103 | password: 'admin', 104 | fullname: "Technical Administration Account", 105 | email: 'admin@example.com', 106 | permissions: [ "hudson.model.Hudson.Administer" ] 107 | }, 108 | { 109 | id: 'mjansen', 110 | password: 'mjansen', 111 | email: 'mjansen@example.com', 112 | fullname: "Michael Jansen", 113 | permissions: [ "hudson.model.Hudson.Administer" ] 114 | }, 115 | { 116 | id: 'test1', 117 | password: 'mjansen', 118 | email: 'mjansen@example.com', 119 | fullname: "Michael Jansen", 120 | permissions: [ 121 | "hudson.model.Computer.Configure", 122 | "hudson.model.Item.Discover", 123 | "hudson.model.View.Delete", 124 | "hudson.model.Run.Update", 125 | "com.cloudbees.plugins.credentials.CredentialsProvider.Update" ] 126 | } 127 | ] 128 | 129 | 130 | 131 | 132 | .. _job-dsl: https://github.com/jenkinsci/job-dsl-plugin 133 | 134 | -------------------------------------------------------------------------------- /doc/roles/jenkins/deploy.rst: -------------------------------------------------------------------------------- 1 | Role jenkins/deploy 2 | =================== 3 | 4 | Deploy the jenkins webapp into a application server. Currently only `apache tomcat`_ is supported. 5 | 6 | The application server is *not* started after dropping jenkins. Neither is it stopped before doing that. 7 | 8 | It will download and drop jenkins into the tomcat at *catalina_base*. 9 | 10 | .. ansible:role:: jenkins/core 11 | 12 | :become: No 13 | :default jenkins_download_mirror: Mirror to download from (default: http://mirrors.jenkins-ci.org/war) 14 | :default jenkins_deploy_default_context_path: Apache tomcat context path (default: `"jenkins"`). 15 | 16 | :param version: Jenkins version to install (eg. 1.643) 17 | :param checksum: Checksum for the jenkins archive (eg. 4b7ba7a5af0a5c395c0740fc011b59d1) 18 | :param catalina_base: Tomcat instance to install into. 19 | :param jenkins_home: Jenkins instance home. 20 | :param context_path: Apache tomcat context path (default: `"{{jenkins_deploy_default_context_path}}"`) 21 | :param cache_directory: Where to cache downloaded artifacts for future reuse on play host. 22 | 23 | The `context_path` becomes part of your jenkins url. Change to ROOT to deploy it at the top-level. 24 | 25 | .. include:: ../../_references.txt 26 | 27 | -------------------------------------------------------------------------------- /doc/roles/jenkins/plugins.rst: -------------------------------------------------------------------------------- 1 | Role jenkins/plugins 2 | ==================== 3 | 4 | Download and install the plugins specified in *plugins*. 5 | 6 | An example 7 | 8 | .. code-block:: yaml 9 | 10 | - jenkins_plugins: 11 | 12 | # CVS Plug-in 13 | - name: cvs 14 | version: "2.12" 15 | enabled: true 16 | bundled: true 17 | pinned: yes 18 | 19 | # Javadoc Plugin 20 | - name: javadoc 21 | version: "1.3" 22 | enabled: true 23 | bundled: true 24 | pinned: yes 25 | 26 | If your plugins get overwritten after installation on a restart you need to look up the definition of 27 | `pinned plugins`_. 28 | 29 | To clone a jenkins instance executing the following script will give you the plugins in correct format 30 | 31 | .. code-block:: groovy 32 | 33 | for (plugin in Jenkins.instance.pluginManager.plugins) 34 | { 35 | pinned = plugin.pinned 36 | if (plugin.hasUpdate()) 37 | { 38 | if (plugin.bundled) 39 | { 40 | pinned = false 41 | } 42 | version = plugin.updateInfo.version 43 | } 44 | else 45 | { 46 | version = plugin.version 47 | } 48 | 49 | println("""\ 50 | # ${plugin.displayName} 51 | - name: ${plugin.shortName} 52 | version: "${version}" 53 | enabled: ${plugin.active} 54 | bundled: ${plugin.bundled} 55 | pinned: ${pinned} 56 | """.stripIndent()) 57 | 58 | } 59 | 60 | .. ansible:role:: jenkins/plugins 61 | 62 | :become: No 63 | 64 | :default jenkins_plugins_download_url: The url to download from. 65 | 66 | :param jenkins_home: Jenkins instance home. 67 | :param plugins: List of plugins to install. See description (default: []). 68 | 69 | .. _pinned plugins: https://wiki.jenkins-ci.org/display/JENKINS/Pinned+Plugins 70 | 71 | 72 | -------------------------------------------------------------------------------- /doc/roles/lang.rst: -------------------------------------------------------------------------------- 1 | Programming Languages 2 | ===================== 3 | 4 | Roles to install programming languages 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | :glob: 9 | 10 | lang/* 11 | 12 | -------------------------------------------------------------------------------- /doc/roles/lang/groovy-sdk.rst: -------------------------------------------------------------------------------- 1 | Role lang/groovy-sdk 2 | ==================== 3 | 4 | Download and install `apache groovy`_. 5 | 6 | .. ansible:role:: lang/groovy-sdk 7 | 8 | :become: No 9 | :default lang_groovy_sdk_server: The download server to use (default: `"http://dl.bintray.com"`). 10 | :default lang_groovy_default_version: The default version to install. (default: `"2.4.5"`). 11 | :default lang_groovy_install_prefix: The installation_prefix (default: `"{{install_prefix}}/groovy-sdk"`). 12 | :param version: The groovy version number to install (default: `"{{lang_groovy_default_version}}"`). 13 | :param prefix: Installation prefix (default: `{{lang_groov_install_prefix}}`). 14 | :param download_url: Url for the artefact (default: `"{{lang_groovy_sdk_download_server}}/groovy/maven/{{artifact}}"`). 15 | :param artifact: Name of the artifact to download (default: `"apache-groovy-sdk-{{version}}.zip"`). 16 | :param cache_directory: Where to cache downloaded artifacts for future reuse on play host. 17 | 18 | The *prefix* directory needs to exist and writable by the remote user. 19 | 20 | The *cache* directory needs to exist and writable by the local user. 21 | 22 | .. note:: The resulting :envvar:`GROOVY_HOME` is :file:`{{prefix}}/groovy-sdk-{{version}}` 23 | 24 | .. _apache groovy: http://www.groovy-lang.org/ 25 | -------------------------------------------------------------------------------- /doc/roles/lang/oracle-sdk.rst: -------------------------------------------------------------------------------- 1 | Role lang/java/oracle-sdk 2 | ========================= 3 | 4 | Download and install `oracle java sdk`_. 5 | 6 | .. ansible:role:: lang/java/oracle-sdk 7 | 8 | :become: No 9 | 10 | :default lang_java_oracle_sdk_server: The download server. 11 | :default lang_java_oracle_sdk_version: The default java version to install (default: none). 12 | 13 | :param version: The java version number to install (eg. 1.8.0_65)(default: `{{lang_java_oracle_sdk_version}}`. 14 | :param build: The build number of the version (eg. 17). 15 | :param platform: The platform to download. 16 | :param format: The format to download. 17 | :param prefix: Install prefix (default: :file:`{{install_prefix}}/java`). 18 | :param server: Server to download from (default: :file:`{{lang.java.oracle_sdk.server}}`) 19 | :param cache_directory: Where to cache downloaded artifacts for future reuse on play host. 20 | 21 | Values for *platform* are "linux-x64" and "windows-i568". All valid values can be seen at the download page. They 22 | are part of the archive filename. 23 | 24 | Values for *format* are "tar.gz" and ".Z". Downloading and installing `rpms` or `.exe` is not yet implemented. 25 | 26 | The *prefix* directory needs to exist and writable. 27 | 28 | .. note:: The resulting :envvar:`JAVA_HOME` is :file:`{{prefix}}/jdk{{version}}` 29 | 30 | .. _oracle java sdk: http://www.oracle.com/technetwork/java/javase/downloads/index.html 31 | -------------------------------------------------------------------------------- /jenkins/bootstrap-job/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - assert: 3 | that: 4 | # Make sure jenkins_home is set 5 | - jenkins_home is not none 6 | -------------------------------------------------------------------------------- /jenkins/bootstrap-job/tasks/configure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "CONFIGURE | BOOTSTRAP JOB" 3 | # ===================================================================== 4 | action: template 5 | args: 6 | src: "init.groovy.d/80_configure-bootstrap-job.groovy" 7 | dest: "{{jenkins_home}}/init.groovy.d/80_configure-bootstrap-job.groovy" 8 | when: git_repo is defined 9 | -------------------------------------------------------------------------------- /jenkins/bootstrap-job/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: configure.yml 6 | tags: configure 7 | -------------------------------------------------------------------------------- /jenkins/bootstrap-job/templates/init.groovy.d/80_configure-bootstrap-job.groovy: -------------------------------------------------------------------------------- 1 | println("** Configuring bootstrap job") 2 | final JOB_NAME = 'bootstrap-jenkins-instance' 3 | final JOB_COMMANDS = '''\ 4 | job('bootstrap-jenkins') { 5 | scm { 6 | git { 7 | remote { 8 | name('origin') 9 | url('{{git_repo}}') 10 | } 11 | branch('{{git_branch}}') 12 | } 13 | } 14 | 15 | steps { 16 | dsl { 17 | removeAction('DISABLE') 18 | external('src/main/jobs/*.groovy') 19 | } 20 | } 21 | } 22 | ''' 23 | 24 | import hudson.model.Cause 25 | import hudson.model.FreeStyleProject 26 | import jenkins.model.Jenkins 27 | import javaposse.jobdsl.plugin.ExecuteDslScripts 28 | 29 | def jenkins = Jenkins.instance 30 | 31 | // Get the job to work with 32 | def job = jenkins.getItem(JOB_NAME) 33 | if(!job) 34 | { 35 | // The job does not yet exist. Create it. 36 | job = new FreeStyleProject(jenkins, JOB_NAME) 37 | } 38 | 39 | // Basis configuration for the job 40 | job.setDisplayName('Jenkins Instance Bootstrap job') 41 | job.setDescription('''\ 42 | This job will bootstrap the jenkins instance by downloading job-dsl scripts from a vcs and running them 43 | ''') 44 | 45 | // Set the log rotator 46 | job.logRotator = new hudson.tasks.LogRotator(-1, 10, -1, 10) 47 | 48 | // Clean out all old buildsteps 49 | job.buildersList.clear() 50 | 51 | // Put in out new buildstep 52 | step = new ExecuteDslScripts(JOB_COMMANDS) 53 | job.buildersList.add(step) 54 | 55 | // Save changes to job and jenkins 56 | job.save() 57 | jenkins.reload() 58 | 59 | -------------------------------------------------------------------------------- /jenkins/bootstrap-job/vars/main.yml: -------------------------------------------------------------------------------- 1 | # :arg jenkins_home: Jenkins instance to configure 2 | # :arg git_repo: The git repository to clone 3 | 4 | # The git branch to clone 5 | git_branch: master 6 | 7 | -------------------------------------------------------------------------------- /jenkins/configure-email-notification/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - assert: 3 | that: 4 | # if smtp_host is set assure a email adress is given. 5 | - smtp_host is none or smtp_replyto is not none 6 | # If a username is given we need a password too 7 | - smtp_username is none or smtp_password is not none 8 | # Make sure jenkins_home is set 9 | - jenkins_home is not none 10 | -------------------------------------------------------------------------------- /jenkins/configure-email-notification/tasks/configure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - debug: var=smtp_host 4 | 5 | - name: "CONFIGURE | EMAIL NOTIFICATION" 6 | # ===================================================================== 7 | action: template 8 | args: 9 | src: "init.groovy.d/configure-email-notification.groovy" 10 | dest: "{{jenkins_home}}/init.groovy.d/40_configure-email-notification.groovy" 11 | when: smtp_host is defined 12 | 13 | -------------------------------------------------------------------------------- /jenkins/configure-email-notification/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: configure.yml 6 | tags: configure 7 | -------------------------------------------------------------------------------- /jenkins/configure-email-notification/templates/init.groovy.d/configure-email-notification.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring email notification") 3 | 4 | import jenkins.model.* 5 | 6 | def inst = Jenkins.getInstance() 7 | def desc = inst.getDescriptor("hudson.tasks.Mailer") 8 | 9 | {% if smtp_host is none %} 10 | // No smtp host configured. Reset everything 11 | 12 | println(" * No smtp host configured. Resetting") 13 | desc.smtpHost = null 14 | desc.smtpPort = null 15 | desc.replyToAddress = null 16 | desc.charset = null 17 | desc.setSmtpAuth(null, null) 18 | 19 | {% else %} 20 | // A smtp host is configured. 21 | 22 | desc.smtpHost = "{{smtp_host}}" 23 | desc.smtpPort = "{{smtp_port}}" 24 | desc.useSsl = {{"true" if smtp_usessl else "false"}} 25 | desc.replyToAddress = "{{smtp_replyto}}" 26 | desc.charset = "{{smtp_charset}}" 27 | {% if smtp_username is defined %} 28 | println(" * Username/Password configured.") 29 | desc.setSmtpAuth("{{smtp_username}}", "{{smtp_password}}") 30 | {% else %} 31 | println(" * Username/Password not configured.") 32 | {% endif %} 33 | 34 | {% endif %} 35 | 36 | // Save the changes 37 | desc.save() 38 | -------------------------------------------------------------------------------- /jenkins/configure-email-notification/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Smtp host to configure. If undefined mailer is reset to null. 2 | smtp_host: null 3 | 4 | # Smtp port. 5 | smtp_port: 587 6 | 7 | # Email sender address 8 | smtp_replyto: null 9 | 10 | # Use SSL for smtp connection? true/false. (default: "true") 11 | smtp_usessl: false # This if for SSL not TLS! 12 | 13 | # Username for smtp authentication. This is optional. 14 | smtp_username: null 15 | 16 | # Password for smtp authentication. Only needed if username is given 17 | smtp_password: null 18 | 19 | # Character encoding 20 | smtp_charset: utf-8 21 | 22 | -------------------------------------------------------------------------------- /jenkins/configure-proxy/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "CHECK | CHECK PARAMETERS" 3 | # ========================================================================= 4 | assert: 5 | that: 6 | # We need jenkins_home 7 | - jenkins_home is defined 8 | # We need both port and hostname or neither 9 | - proxy_host is undefined or proxy_port is defined 10 | # We need both username and password or neither 11 | - proxy_username is undefined or proxy_password is defined 12 | -------------------------------------------------------------------------------- /jenkins/configure-proxy/tasks/configure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "CONFIGURE | PROXY SETTINGS" 3 | # ===================================================================== 4 | action: template 5 | args: 6 | src: "init.groovy.d/configure-proxy.groovy" 7 | dest: "{{jenkins_home}}/init.groovy.d/40_proxy_configuration.groovy" 8 | when: proxy_host is defined 9 | -------------------------------------------------------------------------------- /jenkins/configure-proxy/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: configure.yml 6 | tags: configure 7 | -------------------------------------------------------------------------------- /jenkins/configure-proxy/templates/init.groovy.d/configure-proxy.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | import hudson.ProxyConfiguration 3 | import jenkins.model.Jenkins 4 | {% if proxy_host is defined %} 5 | {% if proxy_username is defined %} 6 | proxy = new ProxyConfiguration( 7 | "{{proxy_host}}", 8 | {{proxy_port}}, 9 | "{{proxy_username}}", 10 | "{{proxy_password}}", 11 | "{{proxy_no_proxy | replace ("\n", "\\n")}}") 12 | {% else %} 13 | proxy = new ProxyConfiguration( 14 | "{{proxy_host}}", 15 | {{proxy_port}}, 16 | null, 17 | null, 18 | "{{proxy_no_proxy | replace ("\n", "\\n")}}") 19 | {% endif %} 20 | {% else %} 21 | proxy = null 22 | {% endif %} 23 | Jenkins.instance.proxy = proxy 24 | -------------------------------------------------------------------------------- /jenkins/configure-proxy/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | proxy_no_proxy: "localhost\n127.0.0.1" -------------------------------------------------------------------------------- /jenkins/configure/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Default authentication strategy 2 | jenkins_default_authentication_strategy: 'hudson_private' 3 | 4 | # Default authorization strategy 5 | jenkins_default_authorization_strategy: 'project_matrix' 6 | 7 | -------------------------------------------------------------------------------- /jenkins/configure/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "CHECK | CHECK PARAMETERS" 3 | # ========================================================================= 4 | assert: 5 | that: 6 | - authentication_strategy in ('hudson_private', 'no_authentication', 'active_directory') 7 | - authorization_strategy in ('global_matrix', 'no_authorization', 'project_matrix', 'full_control_once_logged_in', 'active_directory') 8 | - node_mode | upper in ('EXCLUSIVE', 'NORMAL') 9 | - number_of_executors | int 10 | -------------------------------------------------------------------------------- /jenkins/configure/tasks/configure.yml: -------------------------------------------------------------------------------- 1 | - name: "CONFIGURE | AUTHENTICATION STRATEGY" 2 | # ===================================================================== 3 | action: template 4 | args: 5 | src: "authentication/{{authentication_strategy}}.groovy" 6 | dest: "{{jenkins_home}}/init.groovy.d/00_authentication_strategy.groovy" 7 | 8 | - name: "CONFIGURE | AUTHORIZATION STRATEGY" 9 | # ===================================================================== 10 | action: template 11 | args: 12 | src: "authorization/{{authorization_strategy}}.groovy" 13 | dest: "{{jenkins_home}}/init.groovy.d/20_authorization_strategy.groovy" 14 | 15 | - name: "CONFIGURE | LOCATION PROPERTIES" 16 | # ===================================================================== 17 | action: template 18 | args: 19 | src: "init.groovy.d/configure-location-properties.groovy" 20 | dest: "{{jenkins_home}}/init.groovy.d/40_configure-location-properties.groovy" 21 | 22 | - name: "CONFIGURE | USERS" 23 | # ===================================================================== 24 | action: template 25 | args: 26 | src: "init.groovy.d/configure_users.groovy" 27 | dest: "{{jenkins_home}}/init.groovy.d/60_configure_users.groovy" 28 | 29 | -------------------------------------------------------------------------------- /jenkins/configure/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - include: check.yml 2 | tags: always 3 | 4 | - include: configure.yml 5 | tags: configure -------------------------------------------------------------------------------- /jenkins/configure/templates/authentication/active_directory.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring authentication strategy active_directory") 3 | 4 | // Set the authentication strategy to ActiveDirectorySecurityRealm 5 | import jenkins.model.* 6 | import hudson.plugins.active_directory.* 7 | 8 | // Get the jenkins instance 9 | def instance = Jenkins.getInstance() 10 | 11 | def strategy = GroupLookupStrategy.AUTO 12 | switch ('{{active_directory_groupLookupStrategy}}'.toLowerCase()) { 13 | case 'recursive': 14 | strategy = GroupLookupStrategy.RECURSIVE 15 | break 16 | case 'chain': 17 | strategy = GroupLookupStrategy.CHAIN 18 | break 19 | default: 20 | // keep auto 21 | break 22 | } 23 | 24 | // Create the new security realm and activate it 25 | def realm = new ActiveDirectorySecurityRealm( 26 | '{{active_directory_domain}}', 27 | '{{active_directory_site}}', 28 | '{{active_directory_bindName}}', 29 | '{{active_directory_bindPassword}}', 30 | null, 31 | strategy) 32 | instance.setSecurityRealm(realm) 33 | -------------------------------------------------------------------------------- /jenkins/configure/templates/authentication/hudson_private.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring authentication strategy hudson_private") 3 | // Set the authentication strategy to HudsonPrivateSecurityRealm. 4 | import jenkins.model.* 5 | import hudson.security.* 6 | 7 | // Get the jenkins instance 8 | def instance = Jenkins.getInstance() 9 | 10 | // Create the new security realm and activate it 11 | def realm = new HudsonPrivateSecurityRealm(false) 12 | instance.setSecurityRealm(realm) 13 | -------------------------------------------------------------------------------- /jenkins/configure/templates/authentication/no_authentication.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring authentication strategy no_authentication") 3 | // Set the authentication strategy to SecurityRealm::NO_AUTHENTICATION (default) 4 | import jenkins.model.* 5 | import hudson.security.* 6 | 7 | // Get the jenkins instance 8 | def instance = Jenkins.getInstance() 9 | 10 | // Deactivate the securityx 11 | def realm = SecurityRealm.NO_AUTHENTICATION 12 | instance.setSecurityRealm(realm) 13 | -------------------------------------------------------------------------------- /jenkins/configure/templates/authorization/full_control_once_logged_in.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring authorization strategy full_control_once_logged_in") 3 | // Set the authorization strategy to full_control_once_logged_in 4 | import jenkins.model.* 5 | import hudson.security.* 6 | 7 | // Get the jenkins instance 8 | def instance = Jenkins.getInstance() 9 | 10 | // Create the new strategy and set it 11 | def strategy = new Unsecured() 12 | instance.setAuthorizationStrategy(strategy) 13 | -------------------------------------------------------------------------------- /jenkins/configure/templates/authorization/global_matrix.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring authorization strategy global_matrix") 3 | // Set the authorization strategy to 4 | import jenkins.model.* 5 | import hudson.security.* 6 | 7 | // Get the jenkins instance 8 | def instance = Jenkins.getInstance() 9 | 10 | // Create the new strategy and set it 11 | def strategy = new GlobalMatrixAuthorizationStrategy() 12 | instance.setAuthorizationStrategy(strategy) 13 | -------------------------------------------------------------------------------- /jenkins/configure/templates/authorization/no_authorization.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring authorization strategy no_authorization") 3 | // Set the authorization strategy to unsecured 4 | import jenkins.model.* 5 | import hudson.security.* 6 | 7 | // Get the jenkins instance 8 | def instance = Jenkins.getInstance() 9 | 10 | // Create the new strategy and set it 11 | def strategy = new AuthorizationStrategy.Unsecured() 12 | instance.setAuthorizationStrategy(strategy) 13 | -------------------------------------------------------------------------------- /jenkins/configure/templates/authorization/project_matrix.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring authorization strategy project_matrix") 3 | // Set the authorization strategy to 4 | import jenkins.model.* 5 | import hudson.security.* 6 | 7 | // Get the jenkins instance 8 | def instance = Jenkins.getInstance() 9 | 10 | // Create the new strategy and set it 11 | def strategy = new ProjectMatrixAuthorizationStrategy() 12 | instance.setAuthorizationStrategy(strategy) 13 | -------------------------------------------------------------------------------- /jenkins/configure/templates/init.groovy.d/configure-location-properties.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | println("** Configuring location properties") 3 | import jenkins.model.* 4 | 5 | // System Message 6 | instance = Jenkins.instance 7 | instance.systemMessage = "{{system_message}}" 8 | instance.numExecutors = {{number_of_executors}} 9 | // There is an assertion to make sure only valid values come through. 10 | instance.mode = "{{node_mode | upper}}" 11 | instance.labelString = "{{ node_labels }}" 12 | 13 | 14 | // Location Properties 15 | def jenkinsLocationConfiguration = JenkinsLocationConfiguration.get() 16 | jenkinsLocationConfiguration.setAdminAddress("{{admin_email | default('')}}") 17 | jenkinsLocationConfiguration.setUrl("{{url|default('')}}") 18 | jenkinsLocationConfiguration.save() 19 | -------------------------------------------------------------------------------- /jenkins/configure/templates/init.groovy.d/configure_users.groovy: -------------------------------------------------------------------------------- 1 | // {{ansible_managed}} 2 | // Make sure a admin user exists (if necessary) 3 | 4 | import hudson.model.* 5 | import jenkins.model.* 6 | import hudson.security.* 7 | import hudson.tasks.Mailer 8 | 9 | // Get the jenkins instance. 10 | def instance = Jenkins.getInstance() 11 | 12 | // Get the authentication and authorization strategies 13 | authentication_strategy = instance.getSecurityRealm() 14 | authorization_strategy = instance.getAuthorizationStrategy() 15 | 16 | // With 17 | // void ensure_user(username, password, fullname, email, description=none) { 18 | // i got 19 | // Caused by: java.lang.ClassFormatError: Illegal class name "30_configure_users$ensure_user" in class file 30_configure_users$ensure_user 20 | // at java.lang.ClassLoader.defineClass1(Native Method) 21 | class Helper { 22 | static void ensure_user(username, password, fullname, email, description=none) { 23 | // Check if the user already exists 24 | def instance = Jenkins.getInstance() 25 | def user = instance.securityRealm.allUsers.find {it.id == username} 26 | 27 | if (user == null) { 28 | println("Adding user ${username}") 29 | user = instance.securityRealm.createAccount(username, password) 30 | } 31 | 32 | // We make sure those fields ALWAYS have the desired values and are not changed manually. But we NEVER change 33 | // the password. You are supposed to change it after the first boot. 34 | user.setFullName(fullname) 35 | // user.setDescription(description) 36 | user.addProperty(new Mailer.UserProperty(email)); 37 | } 38 | } 39 | 40 | 41 | println("** Creating the configured users") 42 | switch (authentication_strategy) { 43 | case HudsonPrivateSecurityRealm: 44 | {% for user in users %} 45 | println(" * creating user {{user.id}}") 46 | Helper.ensure_user( 47 | "{{user.id}}", 48 | "{{user.password|default('')}}", 49 | "{{user.fullname|default('')}}", 50 | "{{user.email|default('No email given')}}", 51 | "{{user.description | default('No description given')}}" 52 | ) 53 | {% endfor %} 54 | break 55 | default: 56 | println(" * can not create users. authentication strategy not supported.") 57 | break 58 | } 59 | 60 | println("** Giving permissions to configured users.") 61 | switch(authorization_strategy) { 62 | case GlobalMatrixAuthorizationStrategy: 63 | case ProjectMatrixAuthorizationStrategy: 64 | {% for user in users %} 65 | println(" * configuring permissions for user {{user.id}}") 66 | {% for permission in user.permissions %} 67 | permission = Permission.fromId("{{permission}}") 68 | if (permission) 69 | { 70 | authorization_strategy.add(permission, "{{user.id}}") 71 | } 72 | else 73 | { 74 | println(permission) 75 | println(" !!!! Unknown permission {{permission}}") 76 | } 77 | {% endfor %} 78 | {% endfor %} 79 | break 80 | default: 81 | println(" !!!! can not configure permissions. authorization strategy not supported.") 82 | } 83 | 84 | instance.save() 85 | -------------------------------------------------------------------------------- /jenkins/configure/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Authentication strategy 3 | authentication_strategy: "{{jenkins_default_authentication_strategy}}" 4 | 5 | # Authorization strategy 6 | authorization_strategy: "{{jenkins_default_authorization_strategy}}" 7 | 8 | # System Message 9 | system_message: "Provisioned with ansible, all changes will be lost" 10 | 11 | # Number of executors 12 | number_of_executors: 2 13 | 14 | # Node Usage 15 | node_mode: 'NORMAL' 16 | 17 | # Node label 18 | node_labels: '' 19 | -------------------------------------------------------------------------------- /jenkins/deploy/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Apache tomcat context path 2 | jenkins_deploy_default_context_path: "jenkins" 3 | 4 | jenkins_download_mirror: "http://mirrors.jenkins-ci.org/war" 5 | 6 | -------------------------------------------------------------------------------- /jenkins/deploy/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "INIT | CHECK PARAMETERS" 3 | # ========================================================================= 4 | assert: 5 | that: 6 | # (localhost) where to cache the tomcat archive. 7 | - cache_directory is defined and cache_directory is not none 8 | # We need a TOMCAT_HOME to install jenkins into ($TOMCAT_HOME/webapps) 9 | - catalina_base is defined and catalina_base is not none 10 | # jenkins version to download and install 11 | - version is defined and version is not none 12 | # We should set up a JENKINS_HOME outside of ~/.jenkins (the default). 13 | - jenkins_home is defined and jenkins_home is not none 14 | -------------------------------------------------------------------------------- /jenkins/deploy/tasks/download.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DOWNLOAD | CREATE DOWNLOAD CACHE DIRECTORY 3 | # ===================================================================== 4 | become: No 5 | delegate_to: 127.0.0.1 6 | action: file 7 | args: 8 | path: "{{cache}}/" 9 | state: "directory" 10 | 11 | - name: DOWNLOAD | FETCH ARTIFACT 12 | # ===================================================================== 13 | become: No 14 | delegate_to: 127.0.0.1 15 | action: get_url 16 | args: 17 | url: "{{download_url}}" 18 | dest: "{{cache}}/jenkins-{{version}}.war" 19 | 20 | -------------------------------------------------------------------------------- /jenkins/deploy/tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: INSTALL | CREATE/INITIALIZE JENKINS HOME 3 | # ========================================================================= 4 | action: file 5 | args: 6 | path: "{{item}}" 7 | state: "directory" 8 | with_items: 9 | - "{{jenkins_home}}" 10 | - "{{jenkins_home}}/plugins" 11 | - "{{jenkins_home}}/init.groovy.d" 12 | 13 | - name: INSTALL | CREATE TOMCAT CONTEXT CONFIGURATION DIRECTORY 14 | # ===================================================================== 15 | file: 16 | state: "directory" 17 | path: "{{catalina_base}}/conf/Catalina/localhost" 18 | 19 | - name: INSTALL | CONFIGURE TOMCAT CONTEXT 20 | # ===================================================================== 21 | template: 22 | src: "catalina_context.xml" 23 | dest: "{{catalina_base}}/conf/Catalina/localhost/{{context_path}}.xml" 24 | 25 | - name: INSTALL | DROP INTO TOMCAT 26 | # ===================================================================== 27 | action: copy 28 | args: 29 | src: "{{cache}}/jenkins-{{jenkins_version}}.war" 30 | dest: "{{catalina_base}}/webapps/{{context_path}}.war" 31 | 32 | 33 | -------------------------------------------------------------------------------- /jenkins/deploy/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: download.yml 6 | tags: download 7 | 8 | - include: install.yml 9 | tags: install 10 | 11 | -------------------------------------------------------------------------------- /jenkins/deploy/templates/catalina_context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /jenkins/deploy/vars/main.yml: -------------------------------------------------------------------------------- 1 | # Jenkins version to install 2 | # version: 3 | 4 | # Checksum for the jenkins archive 5 | checksum: 6 | 7 | # Tomcat install to drop into 8 | # catalina_base: 9 | 10 | # JENKINS_HOME to configure for the instance. 11 | # jenkins_home: 12 | 13 | # Archive name to download 14 | archive_name: "jenkins.war" 15 | 16 | # URL of the archive to download 17 | download_url: "{{jenkins_download_mirror}}/{{version}}/{{archive_name}}" 18 | 19 | # Apache tomcat context path 20 | context_path: "{{jenkins_deploy_default_context_path}}" 21 | 22 | # Convenience variables 23 | 24 | # Role cache directory. 25 | cache: "{{cache_directory}}/jenkins.core/" 26 | -------------------------------------------------------------------------------- /jenkins/plugins/defaults/main.yml: -------------------------------------------------------------------------------- 1 | jenkins_plugin_download_url: "http://updates.jenkins-ci.org/download/plugins" 2 | 3 | -------------------------------------------------------------------------------- /jenkins/plugins/tasks/check.yml: -------------------------------------------------------------------------------- 1 | - name: "INIT | CHECK PARAMETERS" 2 | # ========================================================================= 3 | assert: 4 | that: 5 | - jenkins_home is defined and jenkins_home is not none 6 | - plugins is defined 7 | 8 | -------------------------------------------------------------------------------- /jenkins/plugins/tasks/download.yml: -------------------------------------------------------------------------------- 1 | - name: DOWNLOAD | CREATE DOWNLOAD CACHE DIRECTORY 2 | # ===================================================================== 3 | become: No 4 | delegate_to: 127.0.0.1 5 | action: file 6 | args: 7 | path: "{{cache}}/{{item.name}}/" 8 | state: "directory" 9 | with_items: "{{jenkins_plugins}}" 10 | 11 | - name: DOWNLOAD | FETCH ARTIFACTS 12 | # ===================================================================== 13 | become: No 14 | delegate_to: 127.0.0.1 15 | action: get_url 16 | args: 17 | url: "{{jenkins_plugin_download_url}}/{{item.name}}/{{item.version}}/{{item.name}}.hpi" 18 | dest: "{{cache}}/{{item.name}}/{{item.name}}-{{item.version}}.hpi" 19 | when: item.enabled 20 | with_items: "{{jenkins_plugins}}" 21 | -------------------------------------------------------------------------------- /jenkins/plugins/tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: INSTALL | COPY PLUGIN TO JENKINS_HOME 3 | # ========================================================================= 4 | action: copy 5 | args: 6 | src: "{{cache}}/{{item.name}}/{{item.name}}-{{item.version}}.hpi" 7 | dest: "{{jenkins_home}}/plugins/{{item.name}}.jpi" 8 | backup: yes 9 | when: item.enabled 10 | with_items: jenkins_plugins 11 | register: plugin_copy 12 | 13 | - name: INSTALL | KEEP PLUGIN BACKUP VERSION 14 | # ========================================================================= 15 | action: command cp {{item.backup_file}} {{item.dest | replace('.jpi', '.bak')}} 16 | when: item.changed and item.backup_file is defined 17 | with_items: 18 | plugin_copy.results 19 | 20 | - name: INSTALL | PIN PLUGINS 21 | # ========================================================================= 22 | action: file 23 | args: 24 | state: "touch" 25 | dest: "{{jenkins_home}}/plugins/{{item.name}}.jpi.pinned" 26 | when: "{{ item.pinned | default(false) }}" 27 | with_items: jenkins_plugins 28 | 29 | - name: INSTALL | ENABLE PLUGINS 30 | # ========================================================================= 31 | action: file 32 | args: 33 | state: "absent" 34 | dest: "{{jenkins_home}}/plugins/{{item.name}}.jpi.disabled" 35 | when: item.enabled 36 | with_items: jenkins_plugins 37 | 38 | - name: INSTALL | DISABLE PLUGINS 39 | # ========================================================================= 40 | action: file 41 | args: 42 | state: "touch" 43 | dest: "{{jenkins_home}}/plugins/{{item.name}}.jpi.disabled" 44 | when: not item.enabled 45 | with_items: jenkins_plugins 46 | -------------------------------------------------------------------------------- /jenkins/plugins/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include: check.yml 3 | tags: always 4 | 5 | - include: download.yml 6 | tags: download 7 | 8 | - include: install.yml 9 | tags: install 10 | -------------------------------------------------------------------------------- /jenkins/plugins/vars/main.yml: -------------------------------------------------------------------------------- 1 | 2 | # Jenkins instance home 3 | #njenkins_home: 4 | 5 | # Role cache directory. 6 | cache: "{{cache_directory}}/jenkins.plugins/" 7 | -------------------------------------------------------------------------------- /lang/groovy/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Mirror to download from 2 | lang_groovy_sdk_download_server: http://dl.bintray.com/ 3 | 4 | # Default version to install 5 | lang_groovy_sdk_default_version: "2.4.5" 6 | 7 | # The installation prefix 8 | lang_groovy_sdk_install_prefix: "{{install_prefix}}/groovy-sdk" 9 | -------------------------------------------------------------------------------- /lang/groovy/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: CHECK | PARAMETERS 3 | # ========================================================================= 4 | assert: 5 | that: 6 | # Installation prefix 7 | - install_prefix is defined 8 | # Local download cache directory 9 | - cache_directory is defined 10 | -------------------------------------------------------------------------------- /lang/groovy/tasks/download.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DOWNLOAD | CREATE DOWNLOAD CACHE DIRECTORY 3 | # =============================================================================== 4 | become: no 5 | delegate_to: 127.0.0.1 6 | action: file 7 | args: 8 | state: "directory" 9 | path: "{{cache}}" 10 | 11 | - name: DOWNLOAD | FETCH ARTIFACT 12 | # =============================================================================== 13 | become: no 14 | delegate_to: 127.0.0.1 15 | get_url: 16 | url: "{{download_url}}" 17 | dest: "{{cache}}/{{artifact}}" 18 | -------------------------------------------------------------------------------- /lang/groovy/tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: INSTALL | UPLOAD ARTIFACT 3 | # =============================================================================== 4 | action: copy 5 | args: 6 | src: "{{cache}}/{{artifact}}" 7 | dest: "/tmp/{{artifact}}" 8 | 9 | - name: INSTALL | EXTRACT ARTIFACT 10 | # =============================================================================== 11 | action: unarchive 12 | args: 13 | src: "{{cache}}/{{artifact}}" 14 | dest: "{{prefix}}" 15 | creates: "{{groovy_home}}" 16 | 17 | -------------------------------------------------------------------------------- /lang/groovy/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # DOWNLOAD AND INSTALL A JAVA 4 | # 5 | - include: check.yml 6 | tags: always 7 | 8 | - include: download.yml 9 | tags: download 10 | 11 | - include: install.yml 12 | tags: install 13 | 14 | -------------------------------------------------------------------------------- /lang/groovy/vars/main.yml: -------------------------------------------------------------------------------- 1 | # The groovy version to install 2 | version: "{{lang_groovy_sdk_default_version}}" 3 | 4 | # The archive name 5 | artifact: "apache-groovy-sdk-{{version}}.zip" 6 | 7 | # The complete url 8 | download_url: "{{lang_groovy_sdk_download_server}}/groovy/maven/{{artifact}}" 9 | 10 | # The local artifact cache 11 | cache: "{{cache_directory}}/lang.groovy-sdk" 12 | 13 | # Directory to install to 14 | prefix: "{{lang_groovy_sdk_install_prefix}}" 15 | 16 | # The resulting groovy installation 17 | groovy_home: "{{prefix}}/groovy-{{version}}" 18 | -------------------------------------------------------------------------------- /lang/java/oracle-sdk/defaults/main.yml: -------------------------------------------------------------------------------- 1 | lang_java_oracle_sdk_server: "http://download.oracle.com/otn-pub/java/jdk" 2 | 3 | lang_java_oracle_sdk_version: 4 | -------------------------------------------------------------------------------- /lang/java/oracle-sdk/tasks/check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: CHECK | PARAMETERS 3 | # ========================================================================= 4 | assert: 5 | that: 6 | # The java version number to install (eg. 1.8.0_65) 7 | - version and version | match("[0-9]+\.[0-9]+\.[0-9]+_[0-9]+") 8 | # The build number corresponding to the version- 9 | - build 10 | # The platform to download. 11 | - platform 12 | # The format to download. 13 | - format and format in ('tar.gz', 'Z') 14 | # Local download cache directory 15 | - cache_directory 16 | 17 | -------------------------------------------------------------------------------- /lang/java/oracle-sdk/tasks/download.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DOWNLOAD | CREATE DOWNLOAD CACHE DIRECTORY 3 | # =============================================================================== 4 | become: no 5 | delegate_to: 127.0.0.1 6 | action: file 7 | args: 8 | state: "directory" 9 | path: "{{cache}}" 10 | 11 | - name: DOWNLOAD | FETCH ARTIFACT 12 | # =============================================================================== 13 | become: no 14 | delegate_to: 127.0.0.1 15 | command: wget --no-check-certificate --no-cookies --header "Cookie{{':'}} oraclelicense=accept-securebackup-cookie" {{url}} 16 | args: 17 | chdir: "{{cache}}" 18 | creates: "{{artifact}}" 19 | 20 | -------------------------------------------------------------------------------- /lang/java/oracle-sdk/tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: INSTALL | UPLOAD ARTIFACT 3 | # =============================================================================== 4 | action: copy 5 | args: 6 | src: "{{cache}}/{{artifact}}" 7 | dest: "/tmp/{{artifact}}" 8 | 9 | - name: INSTALL | EXTRACT ARTIFACT 10 | # =============================================================================== 11 | action: unarchive 12 | args: 13 | src: "{{cache}}/{{artifact}}" 14 | dest: "{{prefix}}" 15 | creates: "{{java_home}}" 16 | -------------------------------------------------------------------------------- /lang/java/oracle-sdk/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # DOWNLOAD AND INSTALL A JAVA 4 | # 5 | - include: check.yml 6 | tags: always 7 | 8 | - include: download.yml 9 | tags: download 10 | 11 | - include: install.yml 12 | tags: install 13 | 14 | 15 | -------------------------------------------------------------------------------- /lang/java/oracle-sdk/vars/main.yml: -------------------------------------------------------------------------------- 1 | # The java version number to install (eg. 1.8.0_65) 2 | version: "{{lang_java_oracle_sdk_version}}" 3 | 4 | # The build number corresponding to the version- 5 | build: 6 | # The platform to download. 7 | platform: 8 | # The format to download. 9 | format: 10 | # Install prefix 11 | prefix: "{{install_prefix}}/java" 12 | # Server to download from (default: :file:`{{lang.java.oracle_sdk.server}}`) 13 | server: "{{lang_java_oracle_sdk_server}}" 14 | 15 | # Internal convenience variables. 16 | 17 | # The resulting java_home. 18 | java_home: "{{prefix}}/jdk{{version}}" 19 | # Split the version into parts. 20 | major: "{{version.split('.')[0]}}" 21 | minor: "{{version.split('.')[1]}}" 22 | patch: "{{version.partition('_')[0].split('.')[2]}}" 23 | update: "{{version.rpartition('_')[2]}}" 24 | # Role cache directory. 25 | cache: "{{cache_directory}}/lang.java.oracle_sdk/" 26 | # Directory part of download url. 27 | directory: "{{minor}}u{{update}}-b{{build}}" 28 | # Name of the archive to download. 29 | artifact: "jdk-{{minor}}u{{update}}-{{platform}}.{{format}}" 30 | # Full download url. 31 | url: "{{server}}/{{directory}}/{{artifact}}" 32 | --------------------------------------------------------------------------------