From 97da235ca5dc5312224627f261b0c76d4a9c92cd Mon Sep 17 00:00:00 2001 From: Will Parker Date: Thu, 13 Feb 2020 11:17:06 +0000 Subject: [PATCH] Skip for MacOS, fix adopt roles --- .../AdoptOpenJDK_Unix_Playbook/main.yml | 4 +- .../roles/adoptopenjdk8/tasks/main.yml | 102 ------------------ .../roles/adoptopenjdk_install/tasks/main.yml | 76 ++++++------- 3 files changed, 41 insertions(+), 141 deletions(-) delete mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk8/tasks/main.yml diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml index ea56430934..ce459d3f7b 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml @@ -49,7 +49,9 @@ - role: nasm # OpenJ9 when: ansible_architecture == 'x86_64' tags: [build_tools, build_tools_openj9] - - adoptopenjdk8 + - role: adoptopenjdk_install + jdk_version: 8 + tags: build_tools - role: adoptopenjdk_install # JDK11 Build Bootstrap jdk_version: 10 tags: build_tools diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk8/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk8/tasks/main.yml deleted file mode 100644 index 756b6e5185..0000000000 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk8/tasks/main.yml +++ /dev/null @@ -1,102 +0,0 @@ ---- -#################################################### -# ansible install adoptopenjdk8 into /usr/lib/jvm/ # -#################################################### - -# Conditions: -# Check if target is installed -# Proceed with installing to /usr/lib/jvm - -- name: Checking for /usr/lib/jvm - stat: path=/usr/lib/jvm - register: usr_lib_jvm_exists - tags: adoptopenjdk8 - -- name: Creating /usr/lib/jvm if not found - file: - path: /usr/lib/jvm - state: directory - owner: root - mode: 0755 - when: usr_lib_jvm_exists.stat.exists != True - tags: adoptopenjdk8 - -- name: Check if jdk8 is already installed in the target location - shell: ls -ld /usr/lib/jvm/jdk8* >/dev/null 2>&1 - ignore_errors: yes - register: adoptopenjdk8_installed - tags: - - adoptopenjdk8 - - skip_ansible_lint - -- name: Install latest release if one not already installed (Linux/x64) - unarchive: - src: https://api.adoptopenjdk.net/v3/binary/latest/8/ga/linux/x64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk - dest: /usr/lib/jvm - remote_src: yes - retries: 3 - delay: 5 - register: adoptopenjdk8_download - until: adoptopenjdk8_download is not failed - when: - - adoptopenjdk8_installed.rc != 0 - - ansible_architecture == "x86_64" - tags: adoptopenjdk8 - -- name: Install latest release if one not already installed (Linux/s390x) - unarchive: - src: https://api.adoptopenjdk.net/v3/binary/latest/8/ga/linux/s390x/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk - dest: /usr/lib/jvm - remote_src: yes - retries: 3 - delay: 5 - register: adoptopenjdk8_download - until: adoptopenjdk8_download is not failed - when: - - adoptopenjdk8_installed.rc != 0 - - ansible_architecture == "s390x" - tags: adoptopenjdk8 - -- name: Install latest release if one not already installed (Linux/ppc64le) - unarchive: - src: https://api.adoptopenjdk.net/v3/binary/latest/8/ga/linux/ppc64le/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk - dest: /usr/lib/jvm - remote_src: yes - retries: 3 - delay: 5 - register: adoptopenjdk8_download - until: adoptopenjdk8_download is not failed - when: - - adoptopenjdk8_installed.rc != 0 - - ansible_architecture == "ppc64le" - tags: adoptopenjdk8 - -- name: Install latest Hotspot release if one not already installed (Linux/aarch64) - unarchive: - src: https://api.adoptopenjdk.net/v3/binary/latest/8/ga/linux/aarch64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk - dest: /usr/lib/jvm - remote_src: yes - retries: 3 - delay: 5 - register: adoptopenjdk8_download - until: adoptopenjdk8_download is not failed - when: - - adoptopenjdk8_installed.rc != 0 - - ansible_architecture == "aarch64" - tags: adoptopenjdk8 - -- name: Get /usr/lib/jvm/jdk8* full path name - shell: ls -ld /usr/lib/jvm/jdk8* 2>/dev/null | awk '{print $9}' - register: adoptopenjdk8_dir - when: - - adoptopenjdk8_installed.rc != 0 - tags: adoptopenjdk8 - -- name: Chown jdk8* directory - file: - path: '{{ adoptopenjdk8_dir.stdout }}' - state: directory - owner: root - recurse: yes - when: adoptopenjdk8_installed.rc != 0 - tags: adoptopenjdk8 diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml index 80758f137e..3278ee5629 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml @@ -7,9 +7,27 @@ # Check if target is installed # Proceed with installing to /usr/lib/jvm +- name: Set path variable when jdk_version == 8 + set_fact: + path: /usr/lib/jvm/jdk8 + when: + - jdk_version == 8 + - ansible_os_family != "Darwin" + tags: adoptopenjdk_install + +- name: Set path variable when jdk_version != 8 + set_fact: + path: /usr/lib/jvm/jdk-{{ jdk_version }} + when: + - jdk_version != 8 + - ansible_os_family != "Darwin" + tags: adoptopenjdk_install + - name: Checking for /usr/lib/jvm stat: path=/usr/lib/jvm register: usr_lib_jvm_exists + when: + - ansible_os_family != "Darwin" tags: adoptopenjdk_install - name: Creating /usr/lib/jvm if not found @@ -18,13 +36,17 @@ state: directory owner: root mode: 0755 - when: usr_lib_jvm_exists.stat.exists != True + when: + - usr_lib_jvm_exists.stat.exists != True + - ansible_os_family != "Darwin" tags: adoptopenjdk_install - name: Check if jdk-{{ jdk_version }} is already installed in the target location - shell: ls -ld /usr/lib/jvm/jdk-{{ jdk_version }}* >/dev/null 2>&1 + shell: ls -ld {{ path }}* >/dev/null 2>&1 ignore_errors: yes register: adoptopenjdk_installed + when: + - ansible_os_family != "Darwin" tags: - adoptopenjdk_install - skip_ansible_lint @@ -41,25 +63,12 @@ when: - adoptopenjdk_installed.rc != 0 - ansible_architecture == "x86_64" + - ansible_os_family != "Darwin" tags: adoptopenjdk_install -- name: Install latest release if one not already installed (Linux/s390x) - unarchive: - src: https://api.adoptopenjdk.net/v3/binary/latest/{{ jdk_version }}/ga/linux/s390x/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk - dest: /usr/lib/jvm - remote_src: yes - retries: 3 - delay: 5 - register: adoptopenjdk_download - until: adoptopenjdk_download is not failed - when: - - adoptopenjdk_installed.rc != 0 - - ansible_architecture == "s390x" - tags: adoptopenjdk_install - -- name: Install latest release if one not already installed (Linux/ppc64le) +- name: Install latest release if one not already installed (Linux/NOT x64) unarchive: - src: https://api.adoptopenjdk.net/v3/binary/latest/{{ jdk_version }}/ga/linux/ppc64le/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk + src: https://api.adoptopenjdk.net/v3/binary/latest/{{ jdk_version }}/ga/linux/{{ ansible_architecture }}/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk dest: /usr/lib/jvm remote_src: yes retries: 3 @@ -68,34 +77,25 @@ until: adoptopenjdk_download is not failed when: - adoptopenjdk_installed.rc != 0 - - ansible_architecture == "ppc64le" + - ansible_architecture != "x86_64" + - ansible_os_family != "Darwin" tags: adoptopenjdk_install -- name: Install latest Hotspot release if one not already installed (Linux/aarch64) - unarchive: - src: https://api.adoptopenjdk.net/v3/binary/latest/{{ jdk_version }}/ga/linux/aarch64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk - dest: /usr/lib/jvm - remote_src: yes - retries: 3 - delay: 5 - register: adoptopenjdk_download - until: adoptopenjdk_download is not failed - when: - - adoptopenjdk_installed.rc != 0 - - ansible_architecture == "aarch64" - tags: adoptopenjdk_install - -- name: Get /usr/lib/jvm/jdk-{{ jdk_version }}* full path name - shell: ls -ld /usr/lib/jvm/jdk-{{ jdk_version }}* 2>/dev/null | awk '{print $9}' +- name: Get {{ path }}* full path name + shell: ls -ld {{ path }}* 2>/dev/null | awk '{print $9}' register: adoptopenjdk_dir - when: adoptopenjdk_installed.rc != 0 + when: + - adoptopenjdk_installed.rc != 0 + - ansible_os_family != "Darwin" tags: adoptopenjdk_install -- name: Chown /usr/lib/jvm/jdk-{{ jdk_version }}* +- name: Chown {{ path }}* file: path: '{{ adoptopenjdk_dir.stdout }}' state: directory owner: root recurse: yes - when: adoptopenjdk_installed.rc != 0 + when: + - adoptopenjdk_installed.rc != 0 + - ansible_os_family != "Darwin" tags: adoptopenjdk_install