diff --git a/.github/workflows/molecule-test.yml b/.github/workflows/molecule-test.yml new file mode 100644 index 0000000..fa54540 --- /dev/null +++ b/.github/workflows/molecule-test.yml @@ -0,0 +1,43 @@ +--- +name: Molecule Test +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + molecule_distro: ['centos7', 'centos8', 'ubuntu1804', 'ubuntu2004'] + java_version: ['8', '11'] + include: + - molecule_distro: centos7 + java_version: latest + - molecule_distro: centos8 + java_version: latest + - molecule_distro: ubuntu2004 + java_version: 13 + - molecule_distro: ubuntu2004 + java_version: 14 + + env: + ANSIBLE_CALLBACK_WHITELIST: profile_tasks + + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3 + uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible ansible-lint flake8 molecule molecule-docker docker yamllint + ansible --version + ansible-lint --version + molecule --version + - name: Test with molecule + run: | + molecule test --all + env: + MOLECULE_DISTRO: ${{ matrix.molecule_distro }} + JAVA_VERSION: ${{ matrix.java_version }} diff --git a/.gitignore b/.gitignore index c6dd891..df05445 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ # Created by .ignore support plugin (hsz.mobi) *.retry +.cache/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 922a65b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -language: python -services: docker - -env: - matrix: - # Test defaults. - - MOLECULE_DISTRO: centos7 - - MOLECULE_DISTRO: ubuntu1804 - - MOLECULE_DISTRO: ubuntu1604 - - # Test other role features. - - MOLECULE_DISTRO: centos7 - MOLECULE_PLAYBOOK: playbook-java11.yml - - MOLECULE_DISTRO: ubuntu1804 - MOLECULE_PLAYBOOK: playbook-java11.yml - -install: - # Install test dependencies. - - pip install molecule docker - -script: - # Run tests. - - molecule test - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index e773455..cc380ef 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ansible-role-zeppelin ===================== -[![Build Status](https://travis-ci.org/kevincoakley/ansible-role-zeppelin.svg?branch=master)](https://travis-ci.org/kevincoakley/ansible-role-zeppelin) +[![Molecule Test](https://github.com/kevincoakley/ansible-role-zeppelin/actions/workflows/molecule-test.yml/badge.svg)](https://github.com/kevincoakley/ansible-role-zeppelin/actions/workflows/molecule-test.yml) -Install Apache Zeppelin - https://zeppelin.apache.org . Tested with CentOS 7 and Ubuntu 18.04. +Install Apache Zeppelin - https://zeppelin.apache.org . Tested with Zeppelin 0.9.0 with CentOS 7 & 8 and Ubuntu 18.04 & 20.04. Requirements ------------ diff --git a/defaults/main.yml b/defaults/main.yml index 842ab11..2ddfd50 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,15 +1,16 @@ --- -zeppelin_version: 0.8.1 +zeppelin_version: 0.9.0 zeppelin_download_url: http://archive.apache.org/dist/zeppelin/zeppelin-{{ zeppelin_version }}/zeppelin-{{ zeppelin_version }}-bin-all.tgz zeppelin_service_username: zeppelin zeppelin_service_group: zeppelin zeppelin_working_directory: /tmp/zeppelin_working_directory zeppelin_java_home: # Supported Java Versions: -# CentOS 7: 11, 8, or 7 +# CentOS 7: latest, 11, 8, or 7 +# CentOS 8: latest, 11, 8 # Ubuntu 18.04: 11 or 8 -# Ubuntu 16.04: 8 -zeppelin_java_version: 8 +# Ubuntu 20.04: 14, 13, 11, or 8 +zeppelin_java_version: 11 # Config options for zeppelin-site.xml # See templates/zeppelin-site.xml.j2 for defaults. diff --git a/meta/main.yml b/meta/main.yml index 72e9bd2..9d0f54d 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,19 +1,21 @@ --- galaxy_info: role_name: zeppelin + namespace: kevincoakley author: Kevin Coakley description: Install Apache Zeppelin (https://zeppelin.apache.org) # If the issue tracker for your role is not on github, uncomment the license: BSD - min_ansible_version: 2.0 + min_ansible_version: 2.5 platforms: - name: EL versions: - 7 + - 8 - name: Ubuntu versions: - - xenial - bionic + - focal # # Below are all categories currently available. Just as with # the platforms above, uncomment those that apply to your role. diff --git a/molecule/ansible-lint.yml b/molecule/ansible-lint.yml new file mode 100644 index 0000000..bac4c46 --- /dev/null +++ b/molecule/ansible-lint.yml @@ -0,0 +1,6 @@ +--- +warn_list: + - internal-error + - role-name +skip_list: + - yaml diff --git a/molecule/default/playbook.yml b/molecule/default/converge.yml similarity index 60% rename from molecule/default/playbook.yml rename to molecule/default/converge.yml index 4bc0fe4..18c6284 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/converge.yml @@ -4,6 +4,7 @@ become: true vars: + - zeppelin_java_version: "{{ lookup('env','JAVA_VERSION') | default('11', True) }}" - zeppelin_working_directory: /zeppelin_working_directory - zeppelin_mem: "-Xmx512m -XX:MaxPermSize=256m" @@ -13,12 +14,3 @@ post_tasks: - name: Restart any services before running the tests meta: flush_handlers - - - name: Give the Zeppelin time to start - pause: - seconds: 60 - - - name: Verify that Zeppelin is running on port 8080 - uri: - url: http://127.0.0.1:8080 - status_code: 200 diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index ce09cb2..0b78433 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -3,10 +3,11 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint - options: - config-file: molecule/default/yaml-lint.yml +lint: | + set -e + yamllint -c molecule/yaml-lint.yml . + ansible-lint -c molecule/ansible-lint.yml . + flake8 platforms: - name: instance image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" @@ -21,13 +22,12 @@ platforms: pre_build_image: true provisioner: name: ansible - lint: - name: ansible-lint + log: false + options: + vvv: false playbooks: - converge: ${MOLECULE_PLAYBOOK:-playbook.yml} + converge: ${MOLECULE_PLAYBOOK:-converge.yml} scenario: name: default verifier: - name: testinfra - lint: - name: flake8 + name: ansible diff --git a/molecule/default/playbook-java11.yml b/molecule/default/playbook-java11.yml deleted file mode 100644 index 6031d03..0000000 --- a/molecule/default/playbook-java11.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- name: Converge - hosts: all - become: true - - vars: - - zeppelin_java_version: 11 - - zeppelin_working_directory: /zeppelin_working_directory - - zeppelin_mem: "-Xmx512m -XX:MaxPermSize=256m" - - roles: - - role: ansible-role-zeppelin - - post_tasks: - - name: Restart any services before running the tests - meta: flush_handlers - - - name: Give the Zeppelin time to start - pause: - seconds: 60 - - - name: Verify that Zeppelin is running on port 8080 - uri: - url: http://127.0.0.1:8080 - status_code: 200 diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml new file mode 100644 index 0000000..b742f8e --- /dev/null +++ b/molecule/default/verify.yml @@ -0,0 +1,10 @@ +--- +- name: Verify + hosts: all + become: true + + tasks: + - name: Verify that Zeppelin is running on port 8080 + uri: + url: http://127.0.0.1:8080 + status_code: 200 diff --git a/molecule/default/yaml-lint.yml b/molecule/yaml-lint.yml similarity index 100% rename from molecule/default/yaml-lint.yml rename to molecule/yaml-lint.yml diff --git a/tasks/Debian.yml b/tasks/Debian.yml new file mode 100644 index 0000000..a84b4cc --- /dev/null +++ b/tasks/Debian.yml @@ -0,0 +1,22 @@ +--- +# See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199 +- name: Ensure 'man' directory exists. + file: + path: /usr/share/man/man1 + state: directory + recurse: true + when: ansible_distribution == 'Ubuntu' + +- name: fail on unsupported java version (18.04) + fail: + msg: "Java version must be 8 or 11" + when: + - zeppelin_java_version|string not in ["8", "11"] + - ansible_distribution_version == "18.04" + +- name: fail on unsupported java version (20.04) + fail: + msg: "Java version must be 8, 11, 13 or 14" + when: + - zeppelin_java_version|string not in ["8", "11", "13", "14"] + - ansible_distribution_version == "20.04" diff --git a/tasks/RedHat.yml b/tasks/RedHat.yml new file mode 100644 index 0000000..0cf3b9e --- /dev/null +++ b/tasks/RedHat.yml @@ -0,0 +1,14 @@ +--- +- name: fail on unsupported java version (RedHat 7) + fail: + msg: "Java version must be 7, 8, 11 or latest" + when: + - zeppelin_java_version|string not in ["7", "8", "11", "latest"] + - ansible_distribution_major_version == "7" + +- name: fail on unsupported java version (RedHat 8) + fail: + msg: "Java version must be 8, 11 or latest" + when: + - zeppelin_java_version|string not in ["8", "11", "latest"] + - ansible_distribution_major_version == "8" diff --git a/tasks/main.yml b/tasks/main.yml index 4d0d124..4f38bf4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,6 +2,9 @@ - name: Include OS family specific variables include_vars: "{{ ansible_os_family }}.yml" +- name: Include OS specific tasks + include_tasks: "{{ ansible_os_family }}.yml" + - name: Create the zeppelin group group: name: "{{ zeppelin_service_group }}" @@ -41,7 +44,7 @@ - name: Install Java packages package: name={{ item }} - with_items: "{{ zeppelin_java_package[zeppelin_java_version] }}" + with_items: "{{ zeppelin_java_package[zeppelin_java_version|string] }}" register: zeppelin_java_install until: zeppelin_java_install is success retries: 10 @@ -49,7 +52,7 @@ - name: Set Java home from system packages set_fact: - zeppelin_java_home: "{{ zeppelin_java_package_home[zeppelin_java_version] }}" + zeppelin_java_home: "{{ zeppelin_java_package_home[zeppelin_java_version|string] }}" when: not (zeppelin_java_home | default) # diff --git a/vars/Debian.yml b/vars/Debian.yml index 111e335..9c72b32 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,8 +1,12 @@ --- zeppelin_java_package: - 11: openjdk-11-jre-headless - 8: openjdk-8-jre-headless + "14": openjdk-14-jre-headless + "13": openjdk-13-jre-headless + "11": openjdk-11-jre-headless + "8": openjdk-8-jre-headless zeppelin_java_package_home: - 11: /usr/lib/jvm/java-11-openjdk-amd64 - 8: /usr/lib/jvm/java-8-openjdk-amd64/jre + "14": /usr/lib/jvm/java-14-openjdk-amd64 + "13": /usr/lib/jvm/java-13-openjdk-amd64 + "11": /usr/lib/jvm/java-11-openjdk-amd64 + "8": /usr/lib/jvm/java-8-openjdk-amd64/jre zeppelin_packages: [sudo] diff --git a/vars/RedHat.yml b/vars/RedHat.yml index 8553abb..03cf208 100644 --- a/vars/RedHat.yml +++ b/vars/RedHat.yml @@ -1,10 +1,12 @@ --- zeppelin_java_package: - 11: java-11-openjdk-headless - 8: java-1.8.0-openjdk-headless - 7: java-1.7.0-openjdk-headless + latest: java-latest-openjdk-headless + "11": java-11-openjdk-headless + "8": java-1.8.0-openjdk-headless + "7": java-1.7.0-openjdk-headless zeppelin_java_package_home: - 11: /usr/lib/jvm/jre-11 - 8: /usr/lib/jvm/jre-1.8.0 - 7: /usr/lib/jvm/jre-1.7.0 + latest: /usr/lib/jvm/jre + "11": /usr/lib/jvm/jre-11 + "8": /usr/lib/jvm/jre-1.8.0 + "7": /usr/lib/jvm/jre-1.7.0 zeppelin_packages: [sudo]