diff --git a/defaults/main.yml b/defaults/main.yml index 861a60e..07d4fa4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,4 +1,5 @@ --- +nexus_download_url: "http://download.sonatype.com/nexus/3/" nexus_version: '3.3.1-01' nexus_package: "nexus-{{ nexus_version }}-unix.tar.gz" nexus_download_dir: '/tmp' @@ -27,6 +28,8 @@ nexus_docker_hosted_port: 9080 nexus_docker_proxy_port: 9081 nexus_docker_group_port: 9082 nexus_default_context_path: '/' +nexus_api_url: 'service/siesta/rest/v1/script/' +nexus_new_api_url: 'service/rest/v1/script/' nexus_admin_password: 'changeme' # Note : admin password change subsequent to first-time install is *not implemented* yet nexus_anonymous_access: false diff --git a/tasks/call_script.yml b/tasks/call_script.yml index 6cb1d57..7c5fc31 100644 --- a/tasks/call_script.yml +++ b/tasks/call_script.yml @@ -1,7 +1,7 @@ --- - name: Calling Groovy script {{ script_name }} uri: - url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script/{{ script_name }}/run" + url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}{{ nexus_api_url }}{{ script_name }}/run" user: 'admin' password: "{{ current_nexus_admin_password }}" headers: diff --git a/tasks/declare_script_each.yml b/tasks/declare_script_each.yml index ad46e4f..72cdf94 100644 --- a/tasks/declare_script_each.yml +++ b/tasks/declare_script_each.yml @@ -1,16 +1,16 @@ --- - name: Removing (potential) previously declared Groovy script {{ item }} uri: - url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script/{{ item }}" + url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}{{ nexus_api_url }}{{ item }}" user: 'admin' password: "{{ current_nexus_admin_password }}" method: DELETE force_basic_auth: yes - status_code: 204,404 + status_code: 200,204,404 - name: Declaring Groovy script {{ item }} uri: - url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script" + url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}{{ nexus_api_url }}" user: 'admin' password: "{{ current_nexus_admin_password }}" body_format: json diff --git a/tasks/main.yml b/tasks/main.yml index 2943b6e..1928dff 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,15 @@ --- +- name: Determine minor version of Nexus + set_fact: + minor_nexus_version: "{{ nexus_version | regex_search(regexp,'\\1') }}" + vars: + regexp: '3\.(\d+)\..*' + +- name: Set API URL + set_fact: + nexus_api_url: "{{ nexus_new_api_url }}" + when: minor_nexus_version >= 8 + - include: nexus_purge.yml when: ((purge is defined) and (purge | bool))