summaryrefslogtreecommitdiffstats
path: root/ansible/test/roles
diff options
context:
space:
mode:
authorMichal Zegan <m.zegan@samsung.com>2019-05-27 14:00:13 +0200
committerMichal Ptacek <m.ptacek@partner.samsung.com>2019-05-29 10:43:51 +0000
commit8aebe611faaab0274321f1797763fb1d645b98ec (patch)
treec39cdc15080ac680e9487886d11947619392fa9e /ansible/test/roles
parentc6d2813c642eb11d5a4a7d98fada26b4135d5389 (diff)
Add prepare-nexus role
This role can be used by nexus role/infra playbook tests. It downloads and archives the nexus image used by these tests. It also archives some example docker images that can be used to test runtime image pushing. Change-Id: I027dd5dda60ab0abba7701cb038f6552a72e3599 Issue-ID: OOM-1816 Signed-off-by: Samuli Silvius <s.silvius@partner.samsung.com> Signed-off-by: Michal Zegan <m.zegan@samsung.com>
Diffstat (limited to 'ansible/test/roles')
-rw-r--r--ansible/test/roles/prepare-nexus/tasks/main.yml70
-rw-r--r--ansible/test/roles/prepare-nexus/vars/main.yml5
2 files changed, 75 insertions, 0 deletions
diff --git a/ansible/test/roles/prepare-nexus/tasks/main.yml b/ansible/test/roles/prepare-nexus/tasks/main.yml
new file mode 100644
index 00000000..4ef40f5e
--- /dev/null
+++ b/ansible/test/roles/prepare-nexus/tasks/main.yml
@@ -0,0 +1,70 @@
+---
+- name: Add nexus simulation hosts to /etc/hosts
+ lineinfile:
+ regexp: "^{{ ansible_default_ipv4.address | regex_escape() }} {{ etc_hosts | join(' ') | regex_escape() }}$"
+ line: "{{ ansible_default_ipv4.address }} {{ etc_hosts | join(' ') }}"
+ insertafter: EOF
+ path: /etc/hosts
+ unsafe_writes: true
+
+- name: "Create needed dirs for nexus role"
+ file:
+ path: "{{ item }}"
+ state: directory
+ mode: "u+rw,g+wx,o+rwx"
+ recurse: true
+ loop:
+ - "{{ app_data_path }}/nexus_data"
+ - "{{ infra_images_path }}"
+ - "{{ aux_data_path }}"
+
+- name: Download and archive nexus docker image for the nexus role to use
+ delegate_to: localhost
+ docker_image:
+ name: "{{ nexus3_image }}"
+ archive_path: /tmp/nexus.tar
+
+- name: Download and tag additional (busybox) docker image for the nexus role to populate into
+ delegate_to: localhost
+ docker_image:
+ name: busybox
+ tag: latest
+ repository: nexus3.onap.org:10001/onap/components/busybox
+
+- name: Save busybox image
+ delegate_to: localhost
+ docker_image:
+ name: nexus3.onap.org:10001/onap/components/busybox
+ tag: latest
+ pull: false
+ archive_path: /tmp/busybox.tar
+
+- name: Download and tag additional (aaionap/haproxy) docker image for the nexus role to populate into nexus
+ delegate_to: localhost
+ docker_image:
+ name: aaionap/haproxy
+ tag: 1.2.4
+ repository: nexus3.onap.org:10001/onap/components/aaionap/haproxy
+
+- name: Save haproxy image
+ delegate_to: localhost
+ docker_image:
+ name: nexus3.onap.org:10001/onap/components/aaionap/haproxy
+ tag: 1.2.4
+ pull: false
+ archive_path: /tmp/haproxy.tar
+
+- name: Copy nexus image to node
+ copy:
+ src: /tmp/nexus.tar
+ dest: "{{ infra_images_path }}/{{ nexus3_image_tar }}"
+
+- name: Copy busybox image to node
+ copy:
+ src: /tmp/busybox.tar
+ dest: "{{ aux_data_path }}/busybox.tar"
+
+- name: Copy haproxy image to node
+ copy:
+ src: /tmp/haproxy.tar
+ dest: "{{ aux_data_path }}/aaionap-haproxy.tar"
diff --git a/ansible/test/roles/prepare-nexus/vars/main.yml b/ansible/test/roles/prepare-nexus/vars/main.yml
new file mode 100644
index 00000000..d2ee3548
--- /dev/null
+++ b/ansible/test/roles/prepare-nexus/vars/main.yml
@@ -0,0 +1,5 @@
+---
+# Hosts to be added to /etc/hosts file.
+etc_hosts:
+ - nexus.infrastructure-server
+ - nexus3.onap.org