blob: 7e6c20e0328720d6e2d9e07f66b01db49e192ebe [file] [log] [blame]
Michal Zegan3a7e0732018-12-19 11:51:26 +01001---
2- name: "check if the configuration script is uploaded"
3 uri:
4 url: "{{ nexus_url }}/service/rest/v1/script/configure"
5 method: GET
Samuli Silviusf6f5fc42019-02-13 11:00:39 +02006 force_basic_auth: true
Michal Zegan3a7e0732018-12-19 11:51:26 +01007 user: admin
8 password: admin123
9 status_code: [200, 404]
10 register: script
11- block:
12 - name: "upload the configuration script"
13 uri:
14 url: "{{ nexus_url }}/service/rest/v1/script"
15 method: POST
Samuli Silviusf6f5fc42019-02-13 11:00:39 +020016 force_basic_auth: true
Michal Zegan3a7e0732018-12-19 11:51:26 +010017 user: admin
18 password: admin123
19 body_format: json
20 body:
21 name: configure
22 type: groovy
23 content: "{{ lookup('file', 'files/configure.groovy') }}"
24 status_code: [204]
25 - name: "execute configuration script"
26 uri:
27 url: "{{ nexus_url }}/service/rest/v1/script/configure/run"
28 method: POST
Samuli Silviusf6f5fc42019-02-13 11:00:39 +020029 force_basic_auth: true
Michal Zegan3a7e0732018-12-19 11:51:26 +010030 user: admin
31 password: admin123
32 body_format: raw
33 headers: { "Content-Type": "text/plain" }
34 when: script.status == 404