summaryrefslogtreecommitdiffstats
path: root/ansible/roles/nexus/tasks
diff options
context:
space:
mode:
authorSamuli Silvius <s.silvius@partner.samsung.com>2019-02-13 11:00:39 +0200
committerSamuli Silvius <s.silvius@partner.samsung.com>2019-03-04 19:09:57 +0200
commitf6f5fc4fdba4cb36f600d9f13c65ca27ec003b89 (patch)
tree554350f081f30dc5fe32abe4ab4ae34f7c7a669c /ansible/roles/nexus/tasks
parent3313c854585836ec97b72e2ff82d9ed4bf4ed710 (diff)
Re-factor nexus role to streamline playbook
Move nexus functionality into nexus role from infrastructure playbook. This will make role easier to test and make it easier to implement other OS support later. Issue-ID: OOM-1653 Change-Id: I1af2bfef5aa4d6c7b819f5fc40f95c6e8303598c Signed-off-by: Samuli Silvius <s.silvius@partner.samsung.com>
Diffstat (limited to 'ansible/roles/nexus/tasks')
-rw-r--r--ansible/roles/nexus/tasks/configure.yml6
-rw-r--r--ansible/roles/nexus/tasks/insert-images.yml3
-rw-r--r--ansible/roles/nexus/tasks/install.yml14
-rw-r--r--ansible/roles/nexus/tasks/main.yml9
-rw-r--r--ansible/roles/nexus/tasks/runtime-populate.yml1
5 files changed, 26 insertions, 7 deletions
diff --git a/ansible/roles/nexus/tasks/configure.yml b/ansible/roles/nexus/tasks/configure.yml
index 66712d8f..7e6c20e0 100644
--- a/ansible/roles/nexus/tasks/configure.yml
+++ b/ansible/roles/nexus/tasks/configure.yml
@@ -3,7 +3,7 @@
uri:
url: "{{ nexus_url }}/service/rest/v1/script/configure"
method: GET
- force_basic_auth: yes
+ force_basic_auth: true
user: admin
password: admin123
status_code: [200, 404]
@@ -13,7 +13,7 @@
uri:
url: "{{ nexus_url }}/service/rest/v1/script"
method: POST
- force_basic_auth: yes
+ force_basic_auth: true
user: admin
password: admin123
body_format: json
@@ -26,7 +26,7 @@
uri:
url: "{{ nexus_url }}/service/rest/v1/script/configure/run"
method: POST
- force_basic_auth: yes
+ force_basic_auth: true
user: admin
password: admin123
body_format: raw
diff --git a/ansible/roles/nexus/tasks/insert-images.yml b/ansible/roles/nexus/tasks/insert-images.yml
index fb8d7d82..f71d6990 100644
--- a/ansible/roles/nexus/tasks/insert-images.yml
+++ b/ansible/roles/nexus/tasks/insert-images.yml
@@ -14,6 +14,7 @@
docker_image:
name: "{{ runtime_images[component].registry }}{{ runtime_images[component].path }}"
tag: "{{ runtime_images[component].tag }}"
- push: yes
+ push: true
load_path: "{{ item.path }}"
timeout: 120
+ changed_when: false # for idenpotence
diff --git a/ansible/roles/nexus/tasks/install.yml b/ansible/roles/nexus/tasks/install.yml
index 1756b708..99d73dce 100644
--- a/ansible/roles/nexus/tasks/install.yml
+++ b/ansible/roles/nexus/tasks/install.yml
@@ -4,7 +4,7 @@
path: "{{ app_data_path }}/nexus_data"
owner: 200
group: 200
- recurse: yes
+ recurse: true
- name: Load nexus image
docker_image:
@@ -28,3 +28,15 @@
- "{{ app_data_path }}/nexus_data:/nexus-data:rw"
state: started
restart_policy: unless-stopped
+
+- name: Wait for nexus to come up
+ uri:
+ url: "{{ nexus_url }}/service/metrics/healthcheck"
+ user: admin
+ password: admin123
+ force_basic_auth: true
+ method: GET
+ retries: 30
+ delay: 10
+ register: nexus_wait
+ until: not nexus_wait.failed
diff --git a/ansible/roles/nexus/tasks/main.yml b/ansible/roles/nexus/tasks/main.yml
index c5905b13..c1d83515 100644
--- a/ansible/roles/nexus/tasks/main.yml
+++ b/ansible/roles/nexus/tasks/main.yml
@@ -1,2 +1,9 @@
---
-- include_tasks: "{{ phase }}.yml"
+- include_tasks: install.yml
+- include_tasks: configure.yml
+ when: populate_nexus | bool
+- include_tasks: runtime-populate.yml
+ when:
+ - runtime_images is defined
+ - runtime_images is not none
+ - runtime_images.keys() | length > 0
diff --git a/ansible/roles/nexus/tasks/runtime-populate.yml b/ansible/roles/nexus/tasks/runtime-populate.yml
index e22b650e..ac947ec7 100644
--- a/ansible/roles/nexus/tasks/runtime-populate.yml
+++ b/ansible/roles/nexus/tasks/runtime-populate.yml
@@ -9,4 +9,3 @@
# need to iterate over those tasks in include
- include: "insert-images.yml"
with_items: "{{ tar_images.files }}"
-