├── templates └── java_home.sh.j2 ├── .gitignore ├── test.yml ├── .yamllint ├── tasks ├── delete_tmp.yml ├── generate_tmp.yml ├── fetch_jce.yml ├── cleanup_scripts │ ├── delete-messy-rpm-files.sh │ └── uninstall-messy-jdk-packages.sh ├── fetch.yml ├── fetch_mirror.yml ├── use-tarball.yml ├── main.yml ├── use-dmg.yml ├── set-platform-vars.yml ├── use-rpm.yml ├── install_jce.yml ├── install.yml └── set-jdk-vars.yml ├── molecule ├── default │ ├── playbook.yml │ ├── INSTALL.rst │ ├── molecule.yml │ ├── tests │ │ └── test_default.py │ └── Dockerfile.j2 ├── debian9_jdk12 │ ├── playbook.yml │ ├── molecule.yml │ └── Dockerfile.j2 ├── debian9_jdk13 │ ├── playbook.yml │ ├── molecule.yml │ └── Dockerfile.j2 ├── debian9_jdk8_with_var │ ├── playbook.yml │ ├── molecule.yml │ └── Dockerfile.j2 ├── centos6 │ ├── molecule.yml │ └── Dockerfile.j2 ├── debian9 │ ├── molecule.yml │ └── Dockerfile.j2 ├── fedora29 │ ├── molecule.yml │ └── Dockerfile.j2 ├── ubuntu1804 │ ├── molecule.yml │ └── Dockerfile.j2 ├── ubuntu1810 │ ├── molecule.yml │ └── Dockerfile.j2 └── opensuse15 │ ├── molecule.yml │ └── Dockerfile.j2 ├── .editorconfig ├── test_10.yml ├── test_9.yml ├── test_11.yml ├── test_12.yml ├── files └── check-java-version.sh ├── test ├── Dockerfile-centos7 ├── Dockerfile-debian7 ├── Dockerfile-debian8 ├── Dockerfile-debian9 ├── Dockerfile-ubuntu16.04 ├── Dockerfile-ubuntu14.04 ├── Dockerfile-centos6 └── travis │ └── script.sh ├── test_8_local.yml ├── defaults └── main.yml ├── .travis.yml ├── meta └── main.yml ├── Vagrantfile ├── circle.yml ├── prefetch.yml ├── README.md └── LICENSE /templates/java_home.sh.j2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export JAVA_HOME={{ java_install_dir }}/{{ java_default_link_name }} 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | *.retry 3 | *.iml 4 | .idea 5 | 6 | files/jdk-8u181-linux-x64.tar.gz 7 | molecule/default/tests/__pycache__ 8 | .vscode/settings.json -------------------------------------------------------------------------------- /test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ test_hosts|default('all') }}" 3 | become: true 4 | become_method: sudo 5 | tasks: 6 | - import_tasks: 'tasks/main.yml' 7 | vars_files: 8 | - 'defaults/main.yml' 9 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | extends: default 2 | 3 | rules: 4 | braces: 5 | max-spaces-inside: 1 6 | level: error 7 | brackets: 8 | max-spaces-inside: 1 9 | level: error 10 | line-length: 11 | max: 160 12 | -------------------------------------------------------------------------------- /tasks/delete_tmp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Deletes a temporary directory and files 3 | 4 | - name: Delete temporary directory and files 5 | file: 6 | path: "{{ oracle_java.path }}" 7 | state: absent 8 | ignore_errors: true 9 | -------------------------------------------------------------------------------- /molecule/default/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Converge 3 | hosts: all 4 | 5 | vars: 6 | - java_download_path: /tmp/java 7 | - java_remove_download: false 8 | 9 | roles: 10 | - role: ansible-oracle-java 11 | -------------------------------------------------------------------------------- /tasks/generate_tmp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Generates a temporary directory for local file storage 3 | 4 | - name: Generate a temporary directory for local file storage 5 | tempfile: 6 | state: directory 7 | suffix: build 8 | register: oracle_java 9 | -------------------------------------------------------------------------------- /tasks/fetch_jce.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Script for fetching Java Cryptography Extensions (JCE) 3 | 4 | - name: Fetch JCE 5 | get_url: 6 | url: "{{ jce_zip_url }}" 7 | headers: "Cookie:oraclelicense=accept-securebackup-cookie" 8 | dest: "{{ java_download_path }}/{{ jce_zip_file }}" 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | # Unix-style newlines with a newline ending every file 5 | [*.yml] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | charset = utf-8 10 | indent_style = space 11 | indent_size = 2 12 | -------------------------------------------------------------------------------- /molecule/default/INSTALL.rst: -------------------------------------------------------------------------------- 1 | ******* 2 | Docker driver installation guide 3 | ******* 4 | 5 | Requirements 6 | ============ 7 | 8 | * General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html) 9 | * Docker Engine 10 | * docker-py 11 | * docker 12 | 13 | Install 14 | ======= 15 | 16 | $ sudo pip install docker-py 17 | -------------------------------------------------------------------------------- /molecule/debian9_jdk12/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Converge 3 | hosts: all 4 | 5 | vars: 6 | - java_download_path: /tmp/java 7 | - java_remove_download: false 8 | - java_version: 12 9 | # - java_subversion: "" 10 | - java_download_from: oracle 11 | - java_set_java_home: true 12 | 13 | roles: 14 | - role: ansible-oracle-java 15 | -------------------------------------------------------------------------------- /molecule/debian9_jdk13/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Converge 3 | hosts: all 4 | 5 | vars: 6 | - java_download_path: /tmp/java 7 | - java_remove_download: false 8 | - java_version: 13 9 | # - java_subversion: "" 10 | - java_download_from: oracle 11 | - java_set_java_home: true 12 | 13 | roles: 14 | - role: ansible-oracle-java 15 | -------------------------------------------------------------------------------- /molecule/debian9_jdk8_with_var/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Converge 3 | hosts: all 4 | 5 | vars: 6 | - java_download_path: /tmp/java 7 | - java_remove_download: false 8 | - java_version: 8 9 | - java_subversion: 201 10 | - java_download_from: oracle 11 | - java_set_java_home: true 12 | 13 | roles: 14 | - role: ansible-oracle-java 15 | -------------------------------------------------------------------------------- /tasks/cleanup_scripts/delete-messy-rpm-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Simple script to delete messy .rpm files generated by Oracle(Sun) JDK especially sun-javadb series 3 | 4 | path_prefix=$1 5 | 6 | messy_files=( 7 | 'sun-javadb-*.rpm' 8 | '*-linux-amd64.rpm' 9 | ); 10 | 11 | for item in "${messy_files[@]}" 12 | do 13 | echo ${item} 14 | rm -f --interactive=never ${path_prefix}/${item} 15 | done 16 | 17 | exit 0 18 | -------------------------------------------------------------------------------- /tasks/fetch.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Fetches .rpm, .tar.gz or .dmg files directly from Oracle 3 | 4 | - name: Download JDK (as {{ install_file_extension }} file) 5 | get_url: 6 | url: "{{ jdk_file_url }}.{{ install_file_extension }}" 7 | headers: {Cookie: "oraclelicense=accept-securebackup-cookie"} 8 | dest: "{{ java_download_path }}/{{ jdk_file_name }}.{{ install_file_extension }}" 9 | register: jdk_download_response 10 | -------------------------------------------------------------------------------- /molecule/default/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: centos7 10 | image: centos:7 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - centos 15 | provisioner: 16 | name: ansible 17 | lint: 18 | name: ansible-lint 19 | scenario: 20 | name: default 21 | verifier: 22 | name: testinfra 23 | lint: 24 | name: flake8 25 | -------------------------------------------------------------------------------- /tasks/cleanup_scripts/uninstall-messy-jdk-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple script to uninstall messy packages provided by Oracle(Sun) JDK especially sun-javadb series 3 | 4 | messy_packages=( 5 | 'sun-javadb-core' 6 | 'sun-javadb-client' 7 | 'sun-javadb-docs' 8 | 'sun-javadb-javadoc' 9 | 'sun-javadb-demo' 10 | 'sun-javadb-common' 11 | ); 12 | 13 | for pkg in "${messy_packages[@]}" 14 | do 15 | echo ${pkg} 16 | rpm -e ${pkg} 17 | done 18 | 19 | exit 0 20 | -------------------------------------------------------------------------------- /test_10.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ test_hosts|default('all') }}" 3 | become: true 4 | become_method: sudo 5 | tasks: 6 | - import_tasks: 'tasks/main.yml' 7 | 8 | # Variables from defaults/main.yml 9 | vars: 10 | - java_version: 10 11 | - java_download_path: "{{ oracle_java.path }}" 12 | - java_download_from: oracle 13 | - java_mirror: "http://download.oracle.com/otn-pub/java/jdk" 14 | - java_remove_download: false 15 | - java_set_java_home: true 16 | -------------------------------------------------------------------------------- /test_9.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ test_hosts|default('all') }}" 3 | become: true 4 | become_method: sudo 5 | tasks: 6 | - import_tasks: 'tasks/main.yml' 7 | 8 | # vars from defaults/main.yml 9 | vars: 10 | java_version: 9 11 | java_download_path: "{{ oracle_java.path }}" 12 | java_download_from: oracle 13 | java_mirror: "http://download.oracle.com/otn-pub/java/jdk" 14 | java_remove_download: false 15 | java_install_jce: false 16 | java_set_javahome: true 17 | -------------------------------------------------------------------------------- /test_11.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ test_hosts|default('all') }}" 3 | become: true 4 | become_method: sudo 5 | tasks: 6 | - import_tasks: 'tasks/main.yml' 7 | 8 | # Variables from defaults/main.yml 9 | vars: 10 | - java_version: 11 11 | - java_subversion: 0.2 12 | - java_download_path: "{{ oracle_java.path }}" 13 | - java_download_from: oracle 14 | - java_mirror: "http://download.oracle.com/otn-pub/java/jdk" 15 | - java_remove_download: false 16 | - java_set_java_home: true 17 | -------------------------------------------------------------------------------- /test_12.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ test_hosts|default('all') }}" 3 | become: true 4 | become_method: sudo 5 | tasks: 6 | - import_tasks: 'tasks/main.yml' 7 | 8 | # Variables from defaults/main.yml 9 | vars: 10 | - java_version: 12 11 | - java_subversion: "" 12 | - java_download_path: "{{ oracle_java.path }}" 13 | - java_download_from: oracle 14 | - java_mirror: "http://download.oracle.com/otn-pub/java/jdk" 15 | - java_remove_download: false 16 | - java_set_java_home: true 17 | -------------------------------------------------------------------------------- /files/check-java-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # simple script to query the existence of specific Oracle jdk executable, if installed. 3 | # 4 | # @return: JSON string : { "found": true/false, "not_found": true/false } 5 | 6 | export LC_ALL="en_US.UTF-8" 7 | 8 | PACKAGE="\"$1\"" 9 | 10 | line=$(java -version 2>&1 | grep ${PACKAGE} | grep -iv openjdk | wc -l) 11 | 12 | if [[ ${line} =~ 0 ]]; then 13 | echo '{ "found": false , "not_found": true }' 14 | 15 | else 16 | echo '{ "found": true , "not_found": false }' 17 | 18 | fi 19 | -------------------------------------------------------------------------------- /tasks/fetch_mirror.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Fetches .rpm, .tar.gz or .dmg files directly from user defined mirror 3 | 4 | - name: Precondition - java_mirror 5 | fail: msg="ERROR - Required variable 'java_mirror' missing." 6 | when: java_mirror is not defined 7 | 8 | - name: Download JDK from mirror ({{ install_file_extension }}) 9 | get_url: 10 | url: "{{ java_mirror }}" 11 | dest: "{{ java_download_path }}/{{ jdk_file_name }}.{{ install_file_extension }}" 12 | force: true 13 | register: jdk_download_response 14 | ignore_errors: true 15 | -------------------------------------------------------------------------------- /molecule/default/tests/test_default.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import testinfra.utils.ansible_runner 4 | 5 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 6 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 7 | 8 | 9 | def test_java(host): 10 | 11 | assert host.exists("java") 12 | 13 | if (host.system_info.distribution != "opensuse-leap"): 14 | assert host.exists("javac") 15 | assert host.exists("jar") 16 | assert host.exists("keytool") 17 | 18 | assert host.run_test("java -version") 19 | -------------------------------------------------------------------------------- /molecule/centos6/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: centos6 10 | image: centos:6 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - fedora 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: ../default/playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: centos6 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /molecule/debian9/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: debian9 10 | image: debian:9 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - debian 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: ../default/playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: debian9 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /molecule/debian9_jdk12/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: debian9 10 | image: debian:9 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - debian 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: debian9_jdk12 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /molecule/debian9_jdk13/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: debian9 10 | image: debian:9 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - debian 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: debian9_jdk13 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /molecule/fedora29/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: fedora29 10 | image: fedora:29 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - fedora 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: ../default/playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: fedora29 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /molecule/ubuntu1804/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: ubuntu1804 10 | image: ubuntu:18.04 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - ubuntu 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: ../default/playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: ubuntu1804 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /molecule/ubuntu1810/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: ubuntu1810 10 | image: ubuntu:18.10 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - ubuntu 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: ../default/playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: ubuntu1810 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /molecule/debian9_jdk8_with_var/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: debian9 10 | image: debian:9 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - debian 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: debian9_jdk8_with_var 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /molecule/opensuse15/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: opensuse15 10 | image: opensuse/leap:15.1 11 | volumes: 12 | - /tmp/java:/tmp/java 13 | groups: 14 | - suse 15 | provisioner: 16 | name: ansible 17 | playbooks: 18 | converge: ../default/playbook.yml 19 | lint: 20 | name: ansible-lint 21 | scenario: 22 | name: opensuse15 23 | verifier: 24 | name: testinfra 25 | directory: ../default/tests/ 26 | lint: 27 | name: flake8 28 | -------------------------------------------------------------------------------- /test/Dockerfile-centos7: -------------------------------------------------------------------------------- 1 | # Dockerfile for building image that contains software stack provisioned by Ansible. 2 | # 3 | # Version 1.1 4 | # 5 | 6 | 7 | # pull base image 8 | FROM williamyeh/ansible:centos7-onbuild 9 | 10 | MAINTAINER William Yeh 11 | 12 | 13 | # 14 | # build phase 15 | # 16 | 17 | RUN echo "===> Patching defaults/main.yml to enable java_install_jce..." && \ 18 | sed -i -e 's/^java_install_jce:.*/java_install_jce: true/g' defaults/main.yml 19 | 20 | ENV PLAYBOOK test.yml 21 | RUN ansible-playbook-wrapper 22 | 23 | 24 | 25 | # 26 | # test phase 27 | # 28 | 29 | CMD ["java", "-version"] 30 | -------------------------------------------------------------------------------- /test/Dockerfile-debian7: -------------------------------------------------------------------------------- 1 | # Dockerfile for building image that contains software stack provisioned by Ansible. 2 | # 3 | # Version 1.1 4 | # 5 | 6 | 7 | # pull base image 8 | FROM williamyeh/ansible:debian7-onbuild 9 | 10 | MAINTAINER William Yeh 11 | 12 | 13 | # 14 | # build phase 15 | # 16 | 17 | RUN echo "===> Patching defaults/main.yml to enable java_install_jce..." && \ 18 | sed -i -e 's/^java_install_jce:.*/java_install_jce: true/g' defaults/main.yml 19 | 20 | ENV PLAYBOOK test.yml 21 | RUN ansible-playbook-wrapper 22 | 23 | 24 | 25 | # 26 | # test phase 27 | # 28 | 29 | CMD ["java", "-version"] 30 | -------------------------------------------------------------------------------- /test/Dockerfile-debian8: -------------------------------------------------------------------------------- 1 | # Dockerfile for building image that contains software stack provisioned by Ansible. 2 | # 3 | # Version 1.1 4 | # 5 | 6 | 7 | # pull base image 8 | FROM williamyeh/ansible:debian8-onbuild 9 | 10 | MAINTAINER William Yeh 11 | 12 | 13 | # 14 | # build phase 15 | # 16 | 17 | RUN echo "===> Patching defaults/main.yml to enable java_install_jce..." && \ 18 | sed -i -e 's/^java_install_jce:.*/java_install_jce: true/g' defaults/main.yml 19 | 20 | ENV PLAYBOOK test.yml 21 | RUN ansible-playbook-wrapper 22 | 23 | 24 | 25 | # 26 | # test phase 27 | # 28 | 29 | CMD ["java", "-version"] 30 | -------------------------------------------------------------------------------- /test/Dockerfile-debian9: -------------------------------------------------------------------------------- 1 | # Dockerfile for building image that contains software stack provisioned by Ansible. 2 | # 3 | # Version 1.1 4 | # 5 | 6 | 7 | # pull base image 8 | FROM williamyeh/ansible:debian9-onbuild 9 | 10 | MAINTAINER William Yeh 11 | 12 | 13 | # 14 | # build phase 15 | # 16 | 17 | RUN echo "===> Patching defaults/main.yml to enable java_install_jce..." && \ 18 | sed -i -e 's/^java_install_jce:.*/java_install_jce: true/g' defaults/main.yml 19 | 20 | ENV PLAYBOOK test.yml 21 | RUN ansible-playbook-wrapper 22 | 23 | 24 | 25 | # 26 | # test phase 27 | # 28 | 29 | CMD ["java", "-version"] 30 | -------------------------------------------------------------------------------- /test/Dockerfile-ubuntu16.04: -------------------------------------------------------------------------------- 1 | # Dockerfile for building image that contains software stack provisioned by Ansible. 2 | # 3 | # Version 1.1 4 | # 5 | 6 | 7 | # pull base image 8 | FROM williamyeh/ansible:ubuntu16.04-onbuild 9 | 10 | MAINTAINER William Yeh 11 | 12 | 13 | # 14 | # build phase 15 | # 16 | RUN echo "===> Patching defaults/main.yml to enable java_install_jce..." && \ 17 | sed -i -e 's/^java_install_jce:.*/java_install_jce: true/g' defaults/main.yml 18 | 19 | ENV PLAYBOOK test.yml 20 | RUN ansible-playbook-wrapper 21 | 22 | 23 | 24 | # 25 | # test phase 26 | # 27 | 28 | CMD ["java", "-version"] 29 | -------------------------------------------------------------------------------- /test/Dockerfile-ubuntu14.04: -------------------------------------------------------------------------------- 1 | # Dockerfile for building image that contains software stack provisioned by Ansible. 2 | # 3 | # Version 1.1 4 | # 5 | 6 | 7 | # pull base image 8 | FROM williamyeh/ansible:ubuntu14.04-onbuild 9 | 10 | MAINTAINER William Yeh 11 | 12 | 13 | # 14 | # build phase 15 | # 16 | 17 | RUN echo "===> Patching defaults/main.yml to enable java_install_jce..." && \ 18 | sed -i -e 's/^java_install_jce:.*/java_install_jce: true/g' defaults/main.yml 19 | 20 | ENV PLAYBOOK test.yml 21 | RUN ansible-playbook-wrapper 22 | 23 | 24 | 25 | # 26 | # test phase 27 | # 28 | 29 | CMD ["java", "-version"] 30 | -------------------------------------------------------------------------------- /test_8_local.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ test_hosts|default('all') }}" 3 | become: true 4 | become_method: sudo 5 | 6 | tasks: 7 | - import_tasks: 'tasks/main.yml' 8 | 9 | vars: 10 | - java_version: 8 11 | - java_subversion: 201 12 | - java_download_path: /tmp 13 | 14 | # Possible values: 'oracle', 'mirror' or 'local' 15 | - java_download_from: local 16 | 17 | # If you download from a mirror, provide the complete URL including file name (e.g. "https://private-mirror/jdk/jdk-8u172-macosx-x64.dmg") 18 | - java_mirror: "http://download.oracle.com/otn-pub/java/jdk" 19 | 20 | - java_remove_download: false 21 | - java_set_java_home: true 22 | - java_install_jce: true 23 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Variables needed to be defined in user's playbook 3 | # User-configurable defaults 4 | 5 | java_version: 13 6 | java_download_path: /tmp 7 | 8 | # Possible values: 'oracle', 'mirror' or 'local' 9 | java_download_from: oracle 10 | 11 | # If you download from a mirror, provide the complete URL including file name (e.g. "https://private-mirror/jdk/jdk-8u172-macosx-x64.dmg") 12 | java_mirror: "http://download.oracle.com/otn-pub/java/jdk" 13 | 14 | java_remove_download: true 15 | java_set_java_home: true 16 | java_install_jce: false 17 | 18 | # Define the downloadable java subversion. 19 | java_latest_subversion: 20 | 8: 231 21 | 9: 0.4 22 | 10: 0.2 23 | 11: 0.5 24 | 12: 0.2 25 | 13: 0.2 26 | -------------------------------------------------------------------------------- /test/Dockerfile-centos6: -------------------------------------------------------------------------------- 1 | # Dockerfile for building image that contains software stack provisioned by Ansible. 2 | # 3 | # Version 1.1 4 | # 5 | 6 | 7 | # pull base image 8 | FROM williamyeh/ansible:centos6-onbuild 9 | 10 | MAINTAINER William Yeh 11 | 12 | 13 | # 14 | # build phase 15 | # 16 | 17 | RUN echo "===> Installing the missing "tar" utility for Docker image..." && \ 18 | yum -y install tar 19 | 20 | RUN echo "===> Patching defaults/main.yml to enable java_install_jce..." && \ 21 | sed -i -e 's/^java_install_jce:.*/java_install_jce: true/g' defaults/main.yml 22 | 23 | ENV PLAYBOOK test.yml 24 | RUN ansible-playbook-wrapper -vvv 25 | 26 | 27 | 28 | # 29 | # test phase 30 | # 31 | 32 | CMD ["java", "-version"] 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | sudo: true 4 | 5 | services: 6 | - docker 7 | 8 | 9 | matrix: 10 | include: 11 | 12 | - os: linux 13 | env: LINUX=ubuntu16.04 14 | 15 | - os: linux 16 | env: LINUX=ubuntu14.04 17 | 18 | - os: linux 19 | env: LINUX=debian9 20 | 21 | - os: linux 22 | env: LINUX=debian8 23 | 24 | - os: linux 25 | env: LINUX=debian7 26 | 27 | - os: linux 28 | env: LINUX=centos7 29 | 30 | - os: linux 31 | env: LINUX=centos6 32 | 33 | - os: osx 34 | env: LINUX=OSX 35 | 36 | 37 | script: 38 | - test/travis/script.sh 39 | 40 | notifications: 41 | webhooks: https://galaxy.ansible.com/api/v1/notifications/ 42 | -------------------------------------------------------------------------------- /test/travis/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -uo pipefail 4 | 5 | case "${TRAVIS_OS_NAME}" in 6 | linux) 7 | 8 | echo "==> Building test cases..." 9 | docker build -f test/Dockerfile-${LINUX} -t java_${LINUX} . 10 | 11 | echo "==> Run java..." 12 | docker run -i java_${LINUX} 2> result-${LINUX} 13 | 14 | echo "==> Validating the test results..." 15 | 16 | cat result-${LINUX} 17 | sh -c "[ -s result-${LINUX} ]" 18 | ;; 19 | osx) 20 | 21 | echo "==> Running tests using ansible-playbook on Mac OS X..." 22 | ansible-playbook test.yml --extra-vars test_hosts=localhost 23 | 24 | echo "==> Validating the test results..." 25 | java -version 2> result-macosx 26 | sh -c "[ -s result-macosx ]" 27 | ;; 28 | *) 29 | echo "Unknown value of TRAVIS_OS_NAME: '${TRAVIS_OS_NAME}'" >&2 30 | exit 1 31 | esac 32 | -------------------------------------------------------------------------------- /tasks/use-tarball.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Install Oracle JDK 1.x on distributions other than the CentOS/RHEL family 3 | # 4 | # See: https://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html 5 | 6 | - name: Make directory for Java 7 | file: 8 | path: "{{ java_install_dir }}" 9 | state: directory 10 | owner: root 11 | group: root 12 | mode: "u=rwx,go=rx" 13 | become: true 14 | 15 | - name: Make directory for specific Java version 16 | file: 17 | path: "{{ java_install_dir }}/jdk{{ jdk_version }}" 18 | state: directory 19 | owner: root 20 | group: root 21 | mode: "u=rwx,go=rx" 22 | become: true 23 | when: java_version == 8 24 | 25 | - name: Install JDK via tarball file 26 | unarchive: 27 | src: "{{ java_download_path }}/{{ jdk_file_name }}.{{ install_file_extension }}" 28 | dest: "{{ java_install_dir }}" 29 | owner: root 30 | group: root 31 | mode: "go-w" 32 | copy: false 33 | become: true 34 | -------------------------------------------------------------------------------- /molecule/centos6/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/debian9/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/default/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/fedora29/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/debian9_jdk12/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/debian9_jdk13/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/opensuse15/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/ubuntu1804/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/ubuntu1810/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /molecule/debian9_jdk8_with_var/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ 10 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ 11 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 12 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ 13 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 14 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi 15 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Top-level installer for Oracle JDK 3 | 4 | - name: Precondition - java_version 5 | fail: msg="ERROR - Required variable 'java_version' missing." 6 | when: java_version is not defined 7 | 8 | - import_tasks: set-platform-vars.yml 9 | 10 | - import_tasks: set-jdk-vars.yml 11 | 12 | - name: Install libselinux-python binary for Ansible to work 13 | yum: name=libselinux-python state=present 14 | when: ansible_pkg_mgr == "yum" 15 | 16 | - name: Copy scripts to server (check-java-version.sh) 17 | copy: src="check-java-version.sh" dest="{{ java_download_path }}/" mode="a+x" 18 | 19 | - name: Check if specific version of Oracle JDK is installed? 20 | command: "{{ java_download_path }}/check-java-version.sh {{ jdk_version }}" 21 | register: jdk_info 22 | changed_when: false 23 | failed_when: jdk_info.rc > 0 24 | 25 | - import_tasks: generate_tmp.yml 26 | when: (jdk_info.stdout|from_json).not_found 27 | 28 | - import_tasks: install.yml 29 | when: (jdk_info.stdout|from_json).not_found 30 | 31 | - import_tasks: install_jce.yml 32 | when: java_install_jce 33 | -------------------------------------------------------------------------------- /tasks/use-dmg.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Install Oracle JDK 1.x on Mac OS X 3 | # 4 | # Reference: https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html 5 | 6 | - name: Set mount point 7 | set_fact: 8 | mountpoint: "/Volumes/JDK_{{ java_version }}.{{ java_subversion }}" 9 | 10 | - name: Mount the downloaded dmg 11 | command: hdiutil attach -mountpoint {{ mountpoint }} "{{ java_download_path }}/{{ jdk_file_name }}.{{ install_file_extension }}" 12 | args: 13 | creates: "{{ mountpoint }}" 14 | 15 | - name: Set volume name for JDK 12 and below 16 | set_fact: 17 | pkg_name: "{{ mountpoint }}/JDK {{ java_version }} Update {{ java_subversion }}.pkg" 18 | when: java_version < 13 19 | 20 | - name: Set volume name for JDK 13 and up 21 | set_fact: 22 | pkg_name: "{{ mountpoint }}/JDK {{ java_version }}.{{ java_subversion }}.pkg" 23 | when: java_version > 12 24 | 25 | - name: Install the pkg file from the dmg 26 | become: true 27 | become_method: sudo 28 | command: installer -pkg "{{ pkg_name }}" -target / 29 | when: (jdk_info.stdout|from_json).not_found 30 | 31 | - name: Unmount the downloaded dmg 32 | command: hdiutil detach "{{ mountpoint }}" 33 | args: 34 | removes: "{{ mountpoint }}" 35 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: srsp 4 | description: Oracle JDK 8 to 13 for CentOS/Fedora/Debian/Ubuntu/Suse/MacOSX 5 | license: Apache 6 | 7 | min_ansible_version: 2.4.0 8 | 9 | platforms: 10 | - name: Ubuntu 11 | versions: 12 | - precise 13 | - trusty 14 | - xenial 15 | - yakkety 16 | - zesty 17 | - bionic 18 | - name: Debian 19 | versions: 20 | - wheezy 21 | - jessie 22 | - stretch 23 | - buster 24 | - name: EL 25 | versions: 26 | - 6 27 | - 7 28 | - name: fedora 29 | versions: 30 | - 29 31 | - name: opensuse 32 | versions: 33 | - all 34 | - name: SLES 35 | versions: 36 | - all 37 | - name: MacOSX 38 | versions: 39 | - 10.12 40 | - 10.13 41 | - 10.14 42 | 43 | galaxy_tags: 44 | - oracle 45 | - java 46 | - development 47 | - jdk 48 | - jdk8 49 | - jdk9 50 | - jdk10 51 | - jdk11 52 | - jvm 53 | - jce 54 | - system 55 | 56 | dependencies: [] 57 | -------------------------------------------------------------------------------- /tasks/set-platform-vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Architecture & platform-specific variables 3 | 4 | - name: Set Java architecture 5 | set_fact: 6 | jdk_arch: "{{ 'i586' if ansible_architecture == 'i386' else 'x64' }}" 7 | 8 | # OS 9 | 10 | - name: Set Java OS for Linux 11 | set_fact: 12 | jdk_os: linux 13 | when: ansible_system == 'Linux' 14 | 15 | - name: Set Java OS for Mac OS X 16 | set_fact: 17 | jdk_os: macosx 18 | when: ansible_os_family == 'Darwin' 19 | 20 | - name: Set Java OS for Mac OS X 21 | set_fact: 22 | jdk_os: osx 23 | when: ansible_os_family == 'Darwin' and java_version > 8 24 | 25 | # Installation binary 26 | 27 | - name: Set RPM binary 28 | set_fact: 29 | use_rpm: true 30 | use_tarball: false 31 | use_dmg: false 32 | install_file_extension: rpm 33 | when: (ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf" or ansible_pkg_mgr == "zypper") and ansible_os_family != 'Darwin' 34 | 35 | - name: Set Gzipped Tarball binary 36 | set_fact: 37 | use_tarball: true 38 | use_rpm: false 39 | use_dmg: false 40 | install_file_extension: tar.gz 41 | when: ansible_pkg_mgr != "yum" and ansible_pkg_mgr != "dnf" and ansible_pkg_mgr != "zypper" and ansible_os_family != "Darwin" 42 | 43 | - name: Set dmg binary 44 | set_fact: 45 | use_dmg: true 46 | use_rpm: false 47 | use_tarball: false 48 | install_file_extension: dmg 49 | when: ansible_pkg_mgr != "yum" and ansible_pkg_mgr != "dnf" and ansible_pkg_mgr != "zypper" and ansible_os_family == "Darwin" 50 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure(2) do |config| 2 | 3 | # main & default: normal OS series... 4 | config.vm.define "main", primary: true do |node| 5 | #node.vm.box = "ubuntu/trusty64" 6 | #node.vm.box = "ubuntu/precise64" 7 | node.vm.box = "debian/stretch64" 8 | #node.vm.box = "debian/jessie64" 9 | #node.vm.box = "debian/wheezy64" 10 | #node.vm.box = "bento/centos-7.2" 11 | #node.vm.box = "bento/centos-6.7" 12 | 13 | node.vm.provision "ansible" do |ansible| 14 | ansible.playbook = "test_11.yml" 15 | #ansible.playbook = "prefetch.yml" 16 | ansible.become = true 17 | #ansible.verbose = "vvv" 18 | end 19 | end 20 | 21 | 22 | # docker: for auto build & testing (e.g., Travis CI) 23 | # config.vm.define "docker" do |node| 24 | # node.vm.box = "williamyeh/ubuntu-trusty64-docker" 25 | # 26 | # node.vm.provision "shell", inline: <<-SHELL 27 | # cd /vagrant 28 | # docker build -f test/Dockerfile-ubuntu14.04 -t java_trusty . 29 | # docker build -f test/Dockerfile-ubuntu12.04 -t java_precise . 30 | # docker build -f test/Dockerfile-debian8 -t java_jessie . 31 | # docker build -f test/Dockerfile-debian7 -t java_wheezy . 32 | # docker build -f test/Dockerfile-centos7 -t java_centos7 . 33 | # docker build -f test/Dockerfile-centos6 -t java_centos6 . 34 | # SHELL 35 | # end 36 | 37 | end 38 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | machine: 4 | services: 5 | - docker 6 | 7 | dependencies: 8 | override: 9 | - docker info 10 | - docker version 11 | 12 | - echo "==> Prefetching .rpm and .tar.gz to `{{ playbook_dir }}/files`..." 13 | - docker build -f test/Dockerfile-prefetch-rpm -t java_prefetch_rpm . 14 | - docker run -v $(pwd):/data java_prefetch_rpm 15 | - docker build -f test/Dockerfile-prefetch-tarball -t java_prefetch_tarball . 16 | - docker run -v $(pwd):/data java_prefetch_tarball 17 | - sed -i -e 's/^\(java_download_from_oracle:\).*$/\1 false/' defaults/main.yml 18 | 19 | - echo "==> Building test cases..." 20 | - docker build -f test/Dockerfile-ubuntu14.04 -t java_trusty . 21 | - docker build -f test/Dockerfile-ubuntu12.04 -t java_precise . 22 | - docker build -f test/Dockerfile-debian8 -t java_jessie . 23 | - docker build -f test/Dockerfile-debian7 -t java_wheezy . 24 | - docker build -f test/Dockerfile-centos7 -t java_centos7 . 25 | - docker build -f test/Dockerfile-centos6 -t java_centos6 . 26 | 27 | test: 28 | override: 29 | - docker run -i java_trusty 2> result-ubuntu14.04 30 | - docker run -i java_precise 2> result-ubuntu12.04 31 | - docker run -i java_jessie 2> result-debian8 32 | - docker run -i java_wheezy 2> result-debian7 33 | - docker run -i java_centos7 2> result-centos7 34 | - docker run -i java_centos6 2> result-centos6 35 | 36 | - echo "==> Validating the test results..." 37 | - sh -c "[ -s result-ubuntu14.04 ]" 38 | - sh -c "[ -s result-ubuntu12.04 ]" 39 | - sh -c "[ -s result-debian8 ]" 40 | - sh -c "[ -s result-debian7 ]" 41 | - sh -c "[ -s result-centos7 ]" 42 | - sh -c "[ -s result-centos6 ]" 43 | 44 | - echo "==> Saving artifacts to CircleCI for reference..." 45 | - cp files/jdk-* $CIRCLE_ARTIFACTS 46 | - cp files/*.zip $CIRCLE_ARTIFACTS 47 | -------------------------------------------------------------------------------- /tasks/use-rpm.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Install Oracle JDK 1.x on CentOS 3 | # 4 | # Adapted from: http://blog.trifork.com/2013/04/02/ansible-example-playbook-to-setup-jenkins-slave/ 5 | # See also: http://java.dzone.com/articles/installing-oracle-java6-ubuntu 6 | 7 | - name: Uninstall messy packages to avoid blocking conditions 8 | script: "cleanup_scripts/uninstall-messy-jdk-packages.sh" 9 | become: true 10 | 11 | - name: Delete messy .rpm files to avoid blocking conditions 12 | script: "cleanup_scripts/delete-messy-rpm-files.sh {{ java_download_path }}" 13 | become: true 14 | 15 | - name: Install JDK via RPM file with yum 16 | yum: 17 | name: "{{ java_download_path }}/{{ jdk_file_name }}.{{ install_file_extension }}" 18 | state: present 19 | become: true 20 | when: ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf" 21 | 22 | - block: 23 | - name: Symlink /usr/sbin/update-alternatives to /usr/sbin/alternatives 24 | file: src=/usr/sbin/update-alternatives dest=/usr/sbin/alternatives state=link 25 | become: true 26 | 27 | - name: Check if pkg already installed 28 | shell: rpm -ql $(rpm -qp "{{ java_download_path }}/{{ jdk_file_name }}.{{ install_file_extension }}") 29 | args: 30 | warn: false 31 | register: reg_validate 32 | failed_when: reg_validate.rc != 0 and reg_validate.rc != 1 33 | 34 | - name: Install JDK via RPM file with rpm (for zypper) 35 | command: rpm -ivh --nodeps "{{ java_download_path }}/{{ jdk_file_name }}.{{ install_file_extension }}" 36 | args: 37 | warn: false 38 | become: true 39 | when: reg_validate.rc != 0 40 | when: ansible_pkg_mgr == "zypper" 41 | 42 | - name: Uninstall messy packages to avoid blocking conditions 43 | script: "cleanup_scripts/uninstall-messy-jdk-packages.sh" 44 | become: true 45 | 46 | - name: Delete messy .rpm files to avoid blocking conditions 47 | script: "cleanup_scripts/delete-messy-rpm-files.sh {{ java_download_path }}" 48 | become: true 49 | -------------------------------------------------------------------------------- /tasks/install_jce.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Installation script for Java Cryptography Extensions (JCE) 3 | 4 | - block: 5 | - name: Find Java Home in Mac 6 | command: /usr/libexec/java_home 7 | register: java_home_cmd 8 | changed_when: false 9 | 10 | - name: Set java_home 11 | set_fact: java_home={{ java_home_cmd.stdout }} 12 | when: java_home_cmd.skipped is not defined and java_home is not defined 13 | when: ansible_os_family == "Darwin" 14 | 15 | - block: 16 | - name: Make sure 'which' is installed 17 | package: name=which state=present 18 | when: ansible_os_family == "RedHat" 19 | 20 | - name: Find Java Home in Linux 21 | command: dirname $(dirname $(readlink -e $(which java))) 22 | register: java_home_cmd 23 | changed_when: false 24 | 25 | - name: Set java_home 26 | set_fact: java_home={{ java_home_cmd.stdout }} 27 | when: java_home_cmd.skipped is not defined and java_home is not defined 28 | when: ansible_os_family != "Darwin" 29 | 30 | - name: Check if JCE is already installed 31 | shell: "{{ java_home }}/bin/jrunscript -e 'print (javax.crypto.Cipher.getMaxAllowedKeyLength(\"RC5\") >= 256);'" 32 | changed_when: false 33 | ignore_errors: true 34 | register: jce_check 35 | 36 | - block: 37 | - import_tasks: fetch_jce.yml 38 | when: java_download_from == "oracle" 39 | 40 | - name: Copy JCE zip from local 41 | copy: 42 | src: "files/{{ jce_zip_file }}" 43 | dest: "{{ java_download_path }}/{{ jce_zip_file }}" 44 | when: java_download_from == "local" 45 | 46 | - name: Install unzip 47 | package: name=unzip state=present 48 | when: ansible_os_family != "Darwin" 49 | 50 | - name: Extract JCE 51 | unarchive: 52 | src: "{{ java_download_path }}/{{ jce_zip_file }}" 53 | dest: "{{ java_download_path }}/" 54 | copy: false 55 | creates: "{{ java_download_path }}/{{ jce_zip_folder }}" 56 | 57 | - name: Install JCE policies 58 | copy: 59 | src: "{{ java_download_path }}/{{ jce_zip_folder }}/{{ item }}" 60 | dest: "{{ java_home }}/jre/lib/security/{{ item }}" 61 | remote_src: true 62 | mode: 0664 63 | become: true 64 | with_items: 65 | - local_policy.jar 66 | - US_export_policy.jar 67 | 68 | - name: Remove temporary downloaded JCE files, if requested 69 | file: path={{ item }} state=absent 70 | with_items: 71 | - "{{ java_download_path }}/{{ jce_zip_file }}" 72 | - "{{ java_download_path }}/{{ jce_zip_folder }}" 73 | ignore_errors: true 74 | when: java_remove_download 75 | when: jce_check.stdout == "false" 76 | -------------------------------------------------------------------------------- /prefetch.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | 4 | vars_files: 5 | - 'defaults/main.yml' 6 | 7 | tasks: 8 | 9 | - name: Overwrite vars from defaults 10 | set_fact: 11 | # java_version: 8 12 | # java_subversion: 201 13 | java_download_path: /tmp/java 14 | java_install_jce: true 15 | download_tar: true 16 | download_rpm: true 17 | download_dmg: true 18 | 19 | - name: Make sure download path exists 20 | file: 21 | path: "{{ java_download_path }}" 22 | state: directory 23 | 24 | ############## 25 | ### tar.gz ### 26 | ############## 27 | 28 | - block: 29 | - name: Set os and architecture 30 | set_fact: 31 | jdk_os: linux 32 | jdk_arch: x64 33 | use_dmg: false 34 | use_rpm: false 35 | use_tarball: true 36 | install_file_extension: tar.gz 37 | jdk_file_name: false 38 | 39 | - name: Set jdk variables 40 | import_tasks: tasks/set-jdk-vars.yml 41 | 42 | - name: Download from Oracle 43 | import_tasks: tasks/fetch.yml 44 | 45 | when: download_tar 46 | 47 | ############## 48 | ### rpm ### 49 | ############## 50 | 51 | - block: 52 | - name: Set os and architecture 53 | set_fact: 54 | jdk_os: linux 55 | jdk_arch: x64 56 | use_dmg: false 57 | use_rpm: true 58 | use_tarball: false 59 | install_file_extension: rpm 60 | jdk_file_name: false 61 | 62 | - name: Set jdk variables 63 | import_tasks: tasks/set-jdk-vars.yml 64 | 65 | - name: Download from Oracle 66 | import_tasks: tasks/fetch.yml 67 | 68 | when: download_rpm 69 | 70 | ############## 71 | ### dmg ### 72 | ############## 73 | 74 | - block: 75 | - name: Set OS 76 | set_fact: 77 | jdk_os: macosx 78 | when: java_version == 8 79 | 80 | - name: Set OS 81 | set_fact: 82 | jdk_os: osx 83 | when: java_version > 8 84 | 85 | - name: Set file attributes 86 | set_fact: 87 | jdk_arch: x64 88 | use_dmg: true 89 | use_rpm: false 90 | use_tarball: false 91 | install_file_extension: dmg 92 | jdk_file_name: false 93 | 94 | - name: Set jdk variables 95 | import_tasks: tasks/set-jdk-vars.yml 96 | 97 | - name: Download from Oracle 98 | import_tasks: tasks/fetch.yml 99 | 100 | when: download_dmg 101 | 102 | ############## 103 | ### JCE ### 104 | ############## 105 | 106 | - name: Fetch JCE files from Oracle site 107 | import_tasks: tasks/fetch_jce.yml 108 | when: java_install_jce 109 | -------------------------------------------------------------------------------- /tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # file: tasks/install.yml 3 | # Top-level installer for Oracle JDK 4 | 5 | - name: Fetch JDK files from Oracle site 6 | import_tasks: fetch.yml 7 | when: java_download_from == "oracle" 8 | 9 | - name: Fetch JDK files from alternative mirror 10 | import_tasks: fetch_mirror.yml 11 | when: java_download_from == "mirror" 12 | 13 | - name: Fetch JDK file from local file system 14 | copy: 15 | src: "files/{{ jdk_file_name }}.{{ install_file_extension }}" 16 | dest: "{{ java_download_path }}/{{ jdk_file_name }}.{{ install_file_extension }}" 17 | when: java_download_from == "local" 18 | 19 | 20 | - name: Delegate to RPM installation process 21 | import_tasks: use-rpm.yml 22 | when: use_rpm 23 | 24 | - name: Delegate to raw tarball installation process 25 | import_tasks: use-tarball.yml 26 | when: use_tarball 27 | 28 | - name: Delegate to Mac OS X dmg installation 29 | import_tasks: use-dmg.yml 30 | when: use_dmg 31 | 32 | - block: 33 | - name: Make sure /etc/profile.d exists 34 | file: path=/etc/profile.d state=directory 35 | become: true 36 | 37 | - name: export JAVA_HOME 38 | template: 39 | src: ../templates/java_home.sh.j2 40 | dest: /etc/profile.d/java_home.sh 41 | mode: "a+x" 42 | become: true 43 | when: java_set_java_home 44 | 45 | - block: 46 | # No link creation is necessary on Mac OS X -- 47 | # the package installer automatically creates symlinks in /usr/bin. 48 | - name: Link "{{ java_install_dir }}/{{ java_default_link_name }} on RPM based systems for JDK8" 49 | file: 50 | src: "{{ java_install_dir }}/jdk{{ jdk_version }}-amd64" 51 | dest: "{{ java_install_dir }}/{{ java_default_link_name }}" 52 | state: link 53 | when: java_version == 8 and use_rpm 54 | 55 | - name: Link "{{ java_install_dir }}/{{ java_default_link_name }} on non-RPM based systems for JDK8" 56 | file: 57 | src: "{{ java_install_dir }}/jdk{{ jdk_version }}" 58 | dest: "{{ java_install_dir }}/{{ java_default_link_name }}" 59 | state: link 60 | when: java_version == 8 and use_tarball 61 | 62 | - name: Link "{{ java_install_dir }}/{{ java_default_link_name }} on RPM based systems for JDK > 8" 63 | file: 64 | src: "{{ java_install_dir }}/jdk-{{ jdk_version }}" 65 | dest: "{{ java_install_dir }}/{{ java_default_link_name }}" 66 | state: link 67 | when: java_version != 8 and use_rpm 68 | 69 | - name: Link "{{ java_install_dir }}/{{ java_default_link_name }} on non-RPM based systems for JDK > 8" 70 | file: 71 | src: "{{ java_install_dir }}/jdk-{{ jdk_version }}" 72 | dest: "{{ java_install_dir }}/{{ java_default_link_name }}" 73 | state: link 74 | when: java_version != 8 and use_tarball 75 | 76 | - name: Alternatives link for "java" 77 | alternatives: 78 | name: java 79 | link: /usr/bin/java 80 | path: "{{ java_install_dir }}/{{ java_default_link_name }}/bin/java" 81 | 82 | - name: Alternatives link for "javac" 83 | alternatives: 84 | name: javac 85 | link: /usr/bin/javac 86 | path: "{{ java_install_dir }}/{{ java_default_link_name }}/bin/javac" 87 | # Does not work for OpenSuse, because there javac is a slave of java 88 | when: ansible_pkg_mgr != "zypper" 89 | 90 | - name: Alternatives link for "jar" 91 | alternatives: 92 | name: jar 93 | link: /usr/bin/jar 94 | path: "{{ java_install_dir }}/{{ java_default_link_name }}/bin/jar" 95 | # Does not work for OpenSuse, because there jar is a slave of java 96 | when: ansible_pkg_mgr != "zypper" 97 | 98 | - name: Alternatives link for "keytool" 99 | alternatives: 100 | name: keytool 101 | link: /usr/bin/keytool 102 | path: "{{ java_install_dir }}/{{ java_default_link_name }}/bin/keytool" 103 | # Does not work for OpenSuse, because there keytool is a slave of java 104 | when: ansible_pkg_mgr != "zypper" 105 | 106 | - name: Check if "java_sdk" target exists 107 | stat: path=/usr/lib/jvm/java 108 | register: filecheck 109 | 110 | - name: Alternatives link for "java_sdk" 111 | alternatives: 112 | name: java_sdk 113 | link: /usr/lib/jvm/java 114 | path: "{{ java_install_dir }}/{{ java_default_link_name }}" 115 | when: filecheck and filecheck.stat.exists 116 | 117 | become: true 118 | when: ansible_os_family != "Darwin" 119 | 120 | - name: Remove temporary downloaded files, if requested 121 | import_tasks: delete_tmp.yml 122 | ignore_errors: true 123 | when: java_remove_download 124 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # srsp.oracle-java for Ansible Galaxy 2 | 3 | [![Build Status](https://travis-ci.org/srsp/ansible-oracle-java.svg?branch=master)](https://travis-ci.org/srsp/ansible-oracle-java) 4 | 5 | ## Summary 6 | 7 | ⚠️ This is project is unmaintained, because now there are many great alternatives to Oracles JDK. Also Oracle made it really hard to download its JDK. 8 | 9 | Role name in Ansible Galaxy: **[srsp.oracle-java](https://galaxy.ansible.com/srsp/oracle-java/)** 10 | 11 | This Ansible role has the following features related to the Oracle JDK: 12 | 13 | - Install the Oracle JDK in versions 8 to 13. 14 | - Install the optional Java Cryptography Extensions (JCE). [Only needed for any JDK version <= 8u152.](https://bugs.java.com/view_bug.do?bug_id=JDK-8170157) 15 | - Install for CentOS, Debian/Ubuntu, SUSE, and macOS operating systems. 16 | 17 | This role is based on [williamyeh.oracle-java](https://github.com/William-Yeh/ansible-oracle-java), but I wanted more recent Java versions and decided to drop support for older versions. 18 | 19 | If you prefer OpenJDK, try [geerlingguy.java](https://galaxy.ansible.com/geerlingguy/java/). 20 | 21 | ## Automatic download from Oracle 22 | **Attention:** Back in the days this role would download all the JDKs directly from the Oracle site. Oracle cut this possibility step by step. Now you cannot download any version of JDK 8 anymore without Oracle login. For JDK 11 you can only download one older version. JDK 13 can be downloaded at the moment. 23 | 24 | Since this changes non-deterministically every time Oracle releases a new Java version, you should not rely on it. I recommend downloading the JDK manually and installing it by this role. 25 | 26 | ## Role Variables 27 | 28 | ### Basic usage 29 | 30 | This will try to download the JDK from Oracle and install it. 31 | 32 | ```yaml 33 | - hosts: all 34 | 35 | roles: 36 | - srsp.oracle-java 37 | 38 | vars: 39 | # You should set this: 40 | - java_version: 13 41 | # You can omit this (role will then use the latest version it knows): 42 | - java_subversion: 0.2 43 | ``` 44 | 45 | 46 | ## Examples 47 | 48 | ### Install manually downloaded JDK 49 | 50 | Put the downloaded JDK file for your intended system in the `files` directory and set `java_download_from` to `local`: 51 | 52 | ```yaml 53 | 54 | - hosts: all 55 | 56 | roles: 57 | - srsp.oracle-java 58 | 59 | vars: 60 | - java_version: 8 61 | - java_subversion: 201 62 | - java_download_from: local 63 | ``` 64 | 65 | ### Install from your mirror 66 | 67 | ```yaml 68 | 69 | - hosts: all 70 | 71 | roles: 72 | - srsp.oracle-java 73 | 74 | vars: 75 | - java_version: 8 76 | - java_subversion: 172 77 | - java_download_from: mirror 78 | - java_mirror: "http://some.url/in/your/network/jdk-8u172-macosx-x64.dmg" 79 | ``` 80 | 81 | ### Download JDK to local machine (prefetch) 82 | 83 | If you just want the JDK on your local machine (e.g. in order to use the files for the 84 | molecule test or to upload it to your corporate intranet mirror), you can use the 85 | `prefetch.yml` playbook in this role: 86 | 87 | ```bash 88 | ansible-playbook prefetch.yml 89 | ``` 90 | 91 | Change the playbook according to your needs. 92 | 93 | ### If running from the command line 94 | 95 | ```bash 96 | ansible-playbook --ask-become-pass playbook.yml 97 | ``` 98 | 99 | ### Optional variables 100 | 101 | User-configurable defaults: 102 | 103 | ```yaml 104 | # Java Version 105 | java_version: 8 106 | 107 | # Java Subversion 108 | java_subversion: 201 109 | 110 | # Whether to download Java from from Oracle directly 111 | # - oracle: Download from Oracle website on-the-fly. 112 | # - mirror: Download from the URL defined in 'java_mirror'. 113 | # - local: Copies from `files` directory of the role or the playbook on the control machine. 114 | java_download_from: oracle 115 | 116 | # Depending on the value of 'java_download_from' different things happen here: 117 | # - oracle: You don't need to set it. It is prefilled with the Oracle download mirror. 118 | # - mirror: You need to set it the mirror you want to download from. You need to set the complete URL including the file, like in the example below. If you also want the JCE, you need to set 'jce_zip_url' as well. 119 | # - local: 'java_mirror' is not used, therefore the value is ignored. 120 | #java_mirror: "https://private-repo.com/java/jdk-8u172-macosx-x64.dmg" 121 | java_mirror: "http://download.oracle.com/otn-pub/java" 122 | 123 | # Remove temporary downloaded files? 124 | java_remove_download: true 125 | 126 | # Set $JAVA_HOME? 127 | java_set_java_home: true 128 | 129 | # Install JCE? 130 | java_install_jce: false 131 | ``` 132 | 133 | For other configurable options, read `tasks/set-role-variables.yml` file; for example, to see supported `java_version`/`java_subversion` combinations. 134 | 135 | ### I want to install a JDK which you don't yet support! 136 | 137 | No problem! You have to specify the corresponding Java build number in the variables `java_build` and `jdk_tarball_hash` in addition to `java_version` and `java_subversion`, for example: 138 | 139 | ```yaml 140 | # file: playbook.yml 141 | - hosts: all 142 | 143 | roles: 144 | - srsp.oracle-java 145 | 146 | vars: 147 | - java_version: 8 148 | - java_subversion: 141 149 | - java_build: 15 150 | - jdk_tarball_hash: 336fa29ff2bb4ef291e347e091f7f4a7 151 | ``` 152 | 153 | ## License 154 | 155 | Licensed under the Apache License V2.0. See the [LICENSE file](LICENSE) for details. 156 | 157 | ## Development 158 | 159 | ### Testing 160 | 161 | The tests are using `molecule`. Since this role needs a JDK from Oracle, molecule test 162 | containers will mount `/tmp/java`, so the JDK is persisted on the local machine and still 163 | available, when the test container has been destroyed. You can also prefetch the installation file 164 | and put it to `/tmp/java`. 165 | 166 | This will execute the whole test cycle against the default scenario: 167 | 168 | ```bash 169 | molecule test 170 | ``` 171 | 172 | If you want to work on a certain distribution, use something like this: 173 | 174 | ```bash 175 | molecule converge --scenario-name opensuse15 176 | ``` 177 | 178 | If you want to test everything, issue: 179 | 180 | ```bash 181 | molecule test --all 182 | ``` 183 | 184 | This will take a while. 185 | -------------------------------------------------------------------------------- /tasks/set-jdk-vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Set necessary role variables 3 | 4 | # Directories 5 | 6 | - name: Set java installation directory on Debian platforms 7 | set_fact: 8 | java_install_dir: /usr/lib/jvm 9 | java_default_link_name: default-java 10 | java_home: /usr/lib/jvm/default-java 11 | when: ansible_os_family == "Debian" 12 | 13 | - name: Set java installation directory on Mac OS X 14 | set_fact: 15 | # The Java installation directory on Mac OS X is determined by the package itself. 16 | java_install_dir: /no_such_directory 17 | java_default_link_name: default 18 | when: ansible_os_family == "Darwin" 19 | 20 | - name: Set java installation directory on non-Debian platforms 21 | set_fact: 22 | java_install_dir: /usr/java 23 | java_default_link_name: default 24 | java_home: /usr/java/default 25 | when: ansible_os_family != "Debian" and ansible_os_family != "Darwin" 26 | 27 | # Handle java subversion 28 | 29 | - name: "Log latest subversion" 30 | debug: 31 | msg: "Latest subversion {{ java_latest_subversion[java_version] }}" 32 | 33 | - name: Set java subversion 34 | set_fact: 35 | java_subversion: "{{ java_latest_subversion[java_version] }}" 36 | when: java_subversion is not defined 37 | 38 | - name: "Log subversion" 39 | debug: 40 | msg: "Subversion {{ java_subversion }}" 41 | 42 | 43 | ## JDK 9 and above 44 | 45 | - name: Set general internal variables for java > 8 46 | set_fact: 47 | jdk_version: "{{ java_version }}" 48 | when: java_version > 8 and java_subversion | length == 0 49 | 50 | - name: Set general internal variables for java > 8 51 | set_fact: 52 | jdk_version: "{{ java_version }}.{{ java_subversion }}" 53 | when: java_version > 8 and java_subversion | length > 0 54 | 55 | ## JDK 8 56 | 57 | - name: Set general internal variables for java 8 58 | set_fact: 59 | jdk_version: "1.{{ java_version }}.0_{{ java_subversion }}" 60 | when: java_version == 8 61 | 62 | ## Version-specific variables 63 | 64 | # JDK 13 65 | 66 | - name: Set internal variables for 13.0.2 67 | set_fact: 68 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+8" 69 | jdk_tarball_hash: d4173c853231432d94f001e99d882ca7 70 | when: java_version == 13 and java_subversion | float == 0.2 71 | 72 | 73 | # JDK 12 74 | 75 | - name: Set internal variables for 12.0.2 76 | set_fact: 77 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+10" 78 | jdk_tarball_hash: e482c34c86bd4bf8b56c0b35558996b9 79 | when: java_version == 12 and java_subversion | float == 0.2 80 | 81 | - name: Set internal variables for 12.0.1 82 | set_fact: 83 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+12" 84 | jdk_tarball_hash: 69cfe15208a647278a19ef0990eea691 85 | when: java_version == 12 and java_subversion | float == 0.1 86 | 87 | - name: Set internal variables for 12 88 | set_fact: 89 | jdk_version_detail: "{{ java_version }}+33" 90 | jdk_tarball_hash: 312335d836a34c7c8bba9d963e26dc23 91 | when: java_version == 12 and java_subversion | length == 0 92 | 93 | # JDK 11 94 | 95 | - name: Set internal variables for 11.0.5 96 | set_fact: 97 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+10" 98 | jdk_tarball_hash: e51269e04165492b90fa15af5b4eb1a5 99 | when: java_version == 11 and java_subversion | float == 0.5 100 | 101 | - name: Set internal variables for 11.0.3 102 | set_fact: 103 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+12" 104 | jdk_tarball_hash: 37f5e150db5247ab9333b11c1dddcd30 105 | when: java_version == 11 and java_subversion | float == 0.3 106 | 107 | - name: Set internal variables for 11.0.2 108 | set_fact: 109 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+9" 110 | jdk_tarball_hash: f51449fcd52f4d52b93a989c5c56ed3c 111 | when: java_version == 11 and java_subversion | float == 0.2 112 | 113 | # All 11 versions following the current only available for download with oracle account (not supported by this role)! 114 | 115 | - name: Set internal variables for 11.0.1 116 | set_fact: 117 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+13" 118 | jdk_tarball_hash: 90cf5d8f270a4347a95050320eef3fb7 119 | when: java_version == 11 and java_subversion | float == 0.1 120 | 121 | # JDK 10 122 | 123 | - name: Set internal variables for 10 124 | set_fact: 125 | java_subversion: 0.2 126 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+13" 127 | jdk_tarball_hash: 19aef61b38124481863b1413dce1855f 128 | when: java_version == 10 129 | 130 | ## JDK 9 131 | # Only available for download with oracle account (not supported by this role)! 132 | 133 | - name: Set internal variables for 9.0.4 134 | set_fact: 135 | java_subversion: 0.4 136 | jdk_version_detail: "{{ java_version }}.{{ java_subversion }}+11" 137 | jdk_tarball_hash: c2514751926b4512b076cc82f959763f 138 | when: java_version == 9 139 | 140 | ## JDK 8 141 | # Only available for download with oracle account (not supported by this role)! 142 | 143 | - name: set internal variables for 1.8.0_231 144 | set_fact: 145 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b11" 146 | jdk_tarball_hash: 5b13a193868b4bf28bcb45c792fce896 147 | when: java_version == 8 and java_subversion | int == 231 148 | 149 | - name: set internal variables for 1.8.0_212 150 | set_fact: 151 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b10" 152 | jdk_tarball_hash: 59066701cf1a433da9770636fbc4c9aa 153 | when: java_version == 8 and java_subversion | int == 212 154 | 155 | - name: set internal variables for 1.8.0_211 156 | set_fact: 157 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b12" 158 | jdk_tarball_hash: 478a62b7d4e34b78b671c754eaaf38ab 159 | when: java_version == 8 and java_subversion | int == 211 160 | 161 | - name: set internal variables for 1.8.0_201 162 | set_fact: 163 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b09" 164 | jdk_tarball_hash: 42970487e3af4f5aa5bca3f542482c60 165 | when: java_version == 8 and java_subversion | int == 201 166 | 167 | - name: set internal variables for 1.8.0_191 168 | set_fact: 169 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b12" 170 | jdk_tarball_hash: 2787e4a523244c269598db4e85c51e0c 171 | when: java_version == 8 and java_subversion | int == 191 172 | 173 | - name: set internal variables for 1.8.0_181 174 | set_fact: 175 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b13" 176 | jdk_tarball_hash: 96a7b8442fe848ef90c96a2fad6ed6d1 177 | when: java_version == 8 and java_subversion | int == 181 178 | 179 | - name: Set internal variables for 1.8.0_172 180 | set_fact: 181 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b11" 182 | jdk_tarball_hash: a58eab1ec242421181065cdc37240b08 183 | when: java_version == 8 and java_subversion | int == 172 184 | 185 | - name: Set internal variables for 1.8.0_171 186 | set_fact: 187 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b11" 188 | jdk_tarball_hash: 512cd62ec5174c3487ac17c61aaa89e8 189 | when: java_version == 8 and java_subversion | int == 171 190 | 191 | - name: Set internal variables for 1.8.0_161 192 | set_fact: 193 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b12" 194 | jdk_tarball_hash: 2f38c3b165be4555a1fa6e98c45e0808 195 | when: java_version == 8 and java_subversion | int == 161 196 | 197 | - name: Set internal variables for 1.8.0_152 198 | set_fact: 199 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b16" 200 | jdk_tarball_hash: aa0333dd3019491ca4f6ddbe78cdb6d0 201 | when: java_version == 8 and java_subversion | int == 152 202 | 203 | - name: Set internal variables for 1.8.0_151 204 | set_fact: 205 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b12" 206 | jdk_tarball_hash: e758a0de34e24606bca991d704f6dcbf 207 | when: java_version == 8 and java_subversion | int == 151 208 | 209 | - name: Set internal variables for 1.8.0_141 210 | set_fact: 211 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b15" 212 | jdk_tarball_hash: 336fa29ff2bb4ef291e347e091f7f4a7 213 | when: java_version == 8 and java_subversion | int == 141 214 | 215 | - name: Set internal variables for 1.8.0_131 216 | set_fact: 217 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b11" 218 | jdk_tarball_hash: d54c1d3a095b4ff2b6607d096fa80163 219 | when: java_version == 8 and java_subversion | int == 131 220 | 221 | - name: Set internal variables for 1.8.0_121 222 | set_fact: 223 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b13" 224 | jdk_tarball_hash: e9e7ea248e2c4826b92b3f075a80e441 225 | when: java_version == 8 and java_subversion | int == 121 226 | 227 | - name: Set internal variables for 1.8.0_111 228 | set_fact: 229 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b14" 230 | when: java_version == 8 and java_subversion | int == 111 231 | 232 | ### End of java versions 233 | 234 | - name: Set internal variables for generic Java version 235 | set_fact: 236 | jdk_version_detail: "{{ java_version }}u{{ java_subversion }}-b{{ java_build }}" 237 | when: 238 | - jdk_version_detail is not defined 239 | - java_build is defined 240 | 241 | - name: Compose jdk8 filename only if necessary 242 | set_fact: 243 | jdk_file_name: "jdk-{{ java_version }}u{{ java_subversion }}-{{ jdk_os }}-{{ jdk_arch }}" 244 | when: 245 | - jdk_file_name is not defined or not jdk_file_name 246 | - java_version == 8 247 | 248 | - name: Compose jdk filename only if necessary 249 | set_fact: 250 | jdk_file_name: "jdk-{{ jdk_version }}_{{ jdk_os }}-{{ jdk_arch }}_bin" 251 | when: 252 | - jdk_file_name is not defined or not jdk_file_name 253 | - java_version != 8 254 | 255 | - name: Compose url for downloading file when file name given 256 | set_fact: 257 | jdk_file_url: "{{ java_mirror }}/{{ jdk_version_detail }}/{{ jdk_file_name }}" 258 | when: 259 | - jdk_version_detail is defined 260 | - jdk_tarball_hash is not defined 261 | 262 | - name: Compose url for downloading file when hash given 263 | set_fact: 264 | jdk_file_url: "{{ java_mirror }}/{{ jdk_version_detail }}/{{ jdk_tarball_hash }}/{{ jdk_file_name }}" 265 | when: 266 | - jdk_version_detail is defined 267 | - jdk_tarball_hash is defined 268 | 269 | # JCE variables 270 | 271 | - name: Set JCE zip file variables for Java 8 272 | set_fact: 273 | jce_zip_file: "jce_policy-{{ java_version }}.zip" 274 | when: java_subversion | int < 161 275 | 276 | - name: Set JCE variables for Java 8 for oracle mirror 277 | set_fact: 278 | jce_zip_url: "http://download.oracle.com/otn-pub/java/jce/{{ java_version }}/{{ jce_zip_file }}" 279 | jce_zip_folder: "UnlimitedJCEPolicyJDK{{ java_version }}" 280 | when: 281 | - java_version == 8 282 | - java_subversion | int < 161 283 | - java_download_from == "oracle" 284 | 285 | - name: Set JCE variables for Java 8 for alternative mirror 286 | set_fact: 287 | jce_zip_url: "{{ java_mirror }}/{{ jce_zip_file }}" 288 | jce_zip_folder: "UnlimitedJCEPolicyJDK{{ java_version }}" 289 | when: 290 | - java_version == 8 291 | - java_subversion | int < 161 292 | - java_download_from == "mirror" 293 | 294 | # JDKs greater or equal than 8u161 do not need JCE anymore 295 | 296 | - name: Set JCE download file 297 | set_fact: 298 | java_install_jce: false 299 | jce_zip_file: "" 300 | jce_zip_url: "" 301 | jce_zip_folder: "" 302 | when: (java_version > 8) or (java_version == 8 and java_subversion | int >= 161) 303 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2014-2016 William Yeh 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | --------------------------------------------------------------------------------