summaryrefslogtreecommitdiffstats
path: root/ansible/test
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/test')
-rw-r--r--ansible/test/play-infrastructure/molecule/default/cleanup.yml11
-rw-r--r--ansible/test/play-infrastructure/molecule/default/vars.yml8
-rw-r--r--ansible/test/play-resources/molecule/default/playbook.yml10
-rw-r--r--ansible/test/play-resources/molecule/default/prepare.yml3
-rw-r--r--ansible/test/play-resources/molecule/default/vars.yml (renamed from ansible/test/play-resources/molecule/default/group_vars/all.yml)2
-rw-r--r--ansible/test/play-resources/molecule/nfs/molecule.yml5
-rw-r--r--ansible/test/play-resources/molecule/nfs/playbook.yml12
-rw-r--r--ansible/test/play-resources/molecule/nfs/prepare.yml8
-rw-r--r--ansible/test/play-resources/molecule/nfs/vars.yml7
-rw-r--r--ansible/test/roles/cleanup-application/tasks/main.yml9
-rw-r--r--ansible/test/roles/cleanup-dns/tasks/main.yml6
l---------ansible/test/roles/cleanup-nexus/defaults1
-rw-r--r--ansible/test/roles/cleanup-nexus/tasks/main.yml7
-rw-r--r--ansible/test/roles/cleanup-nginx/tasks/main.yml6
-rw-r--r--ansible/test/roles/cleanup-vncserver/tasks/main.yml6
-rw-r--r--ansible/test/roles/prepare-application/defaults/main.yml4
-rw-r--r--ansible/test/roles/prepare-application/tasks/main.yml25
-rw-r--r--ansible/test/roles/prepare-helm/defaults/main.yml3
-rw-r--r--ansible/test/roles/prepare-helm/tasks/main.yml14
-rw-r--r--ansible/test/roles/prepare-nexus/defaults/main.yml12
-rw-r--r--ansible/test/roles/prepare-nexus/tasks/main.yml55
-rw-r--r--ansible/test/roles/prepare-rke/tasks/infra.yml2
22 files changed, 123 insertions, 93 deletions
diff --git a/ansible/test/play-infrastructure/molecule/default/cleanup.yml b/ansible/test/play-infrastructure/molecule/default/cleanup.yml
new file mode 100644
index 00000000..74f38c51
--- /dev/null
+++ b/ansible/test/play-infrastructure/molecule/default/cleanup.yml
@@ -0,0 +1,11 @@
+---
+- name: Cleanup
+ hosts: infrastructure
+ ignore_unreachable: true
+ vars_files:
+ - ../../../../roles/nexus/defaults/main.yml
+ roles:
+ - cleanup-nginx
+ - cleanup-nexus
+ - cleanup-dns
+ - cleanup-vncserver
diff --git a/ansible/test/play-infrastructure/molecule/default/vars.yml b/ansible/test/play-infrastructure/molecule/default/vars.yml
index e91eadb2..8aa774b4 100644
--- a/ansible/test/play-infrastructure/molecule/default/vars.yml
+++ b/ansible/test/play-infrastructure/molecule/default/vars.yml
@@ -16,9 +16,9 @@ molecule_test_registry: nexus3.onap.org:10001
runtime_images:
busybox:
registry: "{{ molecule_test_registry }}"
- path: "/onap/components/busybox"
+ path: "/busybox"
tag: "latest"
- aaionap-haproxy:
+ alpine:
registry: "{{ molecule_test_registry }}"
- path: "/onap/components/aaionap/haproxy"
- tag: "1.2.4"
+ path: "/library/alpine"
+ tag: "latest"
diff --git a/ansible/test/play-resources/molecule/default/playbook.yml b/ansible/test/play-resources/molecule/default/playbook.yml
index 50ba233a..096077a2 100644
--- a/ansible/test/play-resources/molecule/default/playbook.yml
+++ b/ansible/test/play-resources/molecule/default/playbook.yml
@@ -1,6 +1,8 @@
---
-- name: Test resource transfer with ssh
+- name: Initialize
hosts: all
- roles:
- - setup
- - resource-data
+ tasks:
+ - name: Include variables
+ include_vars: vars.yml
+
+- import_playbook: ../../../../resources.yml
diff --git a/ansible/test/play-resources/molecule/default/prepare.yml b/ansible/test/play-resources/molecule/default/prepare.yml
index a4436001..5c8ae654 100644
--- a/ansible/test/play-resources/molecule/default/prepare.yml
+++ b/ansible/test/play-resources/molecule/default/prepare.yml
@@ -2,4 +2,7 @@
- name: Prepare resource-data
hosts: all
roles:
+ - setup
- prepare-resource-data
+ vars_files:
+ - vars.yml
diff --git a/ansible/test/play-resources/molecule/default/group_vars/all.yml b/ansible/test/play-resources/molecule/default/vars.yml
index 558eacb2..46ab3e04 100644
--- a/ansible/test/play-resources/molecule/default/group_vars/all.yml
+++ b/ansible/test/play-resources/molecule/default/vars.yml
@@ -1,5 +1,5 @@
---
-app_data_path: /opt/myleculeapp
+app_data_path: /opt/moleculeapp
aux_data_path: "{{ app_data_path }}/runtime_images_source_dir"
resources_dir: /data
resources_filename: resources_package.tar
diff --git a/ansible/test/play-resources/molecule/nfs/molecule.yml b/ansible/test/play-resources/molecule/nfs/molecule.yml
index 9cff6b8d..11726396 100644
--- a/ansible/test/play-resources/molecule/nfs/molecule.yml
+++ b/ansible/test/play-resources/molecule/nfs/molecule.yml
@@ -32,13 +32,8 @@ platforms:
- name: resource-data
provisioner:
name: ansible
- playbooks:
- cleanup: ../default/cleanup.yml
env:
ANSIBLE_ROLES_PATH: ../../../../roles:../../../roles
- inventory:
- links:
- group_vars: ../default/group_vars
lint:
name: ansible-lint
verifier:
diff --git a/ansible/test/play-resources/molecule/nfs/playbook.yml b/ansible/test/play-resources/molecule/nfs/playbook.yml
index 88440116..096077a2 100644
--- a/ansible/test/play-resources/molecule/nfs/playbook.yml
+++ b/ansible/test/play-resources/molecule/nfs/playbook.yml
@@ -1,8 +1,8 @@
---
-- name: Test resource transfer with nfs
+- name: Initialize
hosts: all
- roles:
- - setup
- - role: resource-data
- vars:
- resources_on_nfs: true
+ tasks:
+ - name: Include variables
+ include_vars: vars.yml
+
+- import_playbook: ../../../../resources.yml
diff --git a/ansible/test/play-resources/molecule/nfs/prepare.yml b/ansible/test/play-resources/molecule/nfs/prepare.yml
index d381ba77..2276f2e8 100644
--- a/ansible/test/play-resources/molecule/nfs/prepare.yml
+++ b/ansible/test/play-resources/molecule/nfs/prepare.yml
@@ -1,7 +1,7 @@
---
-- name: Prepare resource-data
+- name: Prepare
hosts: all
roles:
- - role: prepare-resource-data
- vars:
- resources_on_nfs: true
+ - prepare-resource-data
+ vars_files:
+ - vars.yml
diff --git a/ansible/test/play-resources/molecule/nfs/vars.yml b/ansible/test/play-resources/molecule/nfs/vars.yml
new file mode 100644
index 00000000..2cc4d258
--- /dev/null
+++ b/ansible/test/play-resources/molecule/nfs/vars.yml
@@ -0,0 +1,7 @@
+---
+app_data_path: /opt/moleculeapp
+aux_data_path: "{{ app_data_path }}/runtime_images_source_dir"
+resources_on_nfs: true
+resources_dir: /data
+resources_filename: resources_package.tar
+aux_resources_filename: aux_resources_package.tar
diff --git a/ansible/test/roles/cleanup-application/tasks/main.yml b/ansible/test/roles/cleanup-application/tasks/main.yml
new file mode 100644
index 00000000..cbb8d521
--- /dev/null
+++ b/ansible/test/roles/cleanup-application/tasks/main.yml
@@ -0,0 +1,9 @@
+---
+- name: Clean application role mocked artifacts directories
+ file:
+ path: "{{ item }}"
+ state: absent
+ delegate_to: localhost
+ loop:
+ - certs
+ - application
diff --git a/ansible/test/roles/cleanup-dns/tasks/main.yml b/ansible/test/roles/cleanup-dns/tasks/main.yml
new file mode 100644
index 00000000..738c3540
--- /dev/null
+++ b/ansible/test/roles/cleanup-dns/tasks/main.yml
@@ -0,0 +1,6 @@
+---
+- name: Remove saved dnsmasq image
+ delegate_to: localhost
+ file:
+ path: /tmp/dnsmasq.tar
+ state: absent
diff --git a/ansible/test/roles/cleanup-nexus/defaults b/ansible/test/roles/cleanup-nexus/defaults
new file mode 120000
index 00000000..d9144aae
--- /dev/null
+++ b/ansible/test/roles/cleanup-nexus/defaults
@@ -0,0 +1 @@
+../prepare-nexus/defaults/ \ No newline at end of file
diff --git a/ansible/test/roles/cleanup-nexus/tasks/main.yml b/ansible/test/roles/cleanup-nexus/tasks/main.yml
new file mode 100644
index 00000000..1d1e811b
--- /dev/null
+++ b/ansible/test/roles/cleanup-nexus/tasks/main.yml
@@ -0,0 +1,7 @@
+---
+- name: Remove saved docker images
+ delegate_to: localhost
+ file:
+ path: "{{ item.archive_path }}"
+ state: absent
+ loop: "{{ prepare_nexus_images }}"
diff --git a/ansible/test/roles/cleanup-nginx/tasks/main.yml b/ansible/test/roles/cleanup-nginx/tasks/main.yml
new file mode 100644
index 00000000..94517519
--- /dev/null
+++ b/ansible/test/roles/cleanup-nginx/tasks/main.yml
@@ -0,0 +1,6 @@
+---
+- name: Remove saved nginx docker image
+ delegate_to: localhost
+ file:
+ path: /tmp/nginx.tar
+ state: absent
diff --git a/ansible/test/roles/cleanup-vncserver/tasks/main.yml b/ansible/test/roles/cleanup-vncserver/tasks/main.yml
new file mode 100644
index 00000000..1fcb37d8
--- /dev/null
+++ b/ansible/test/roles/cleanup-vncserver/tasks/main.yml
@@ -0,0 +1,6 @@
+---
+- name: Remove saved vncserver docker image
+ delegate_to: localhost
+ file:
+ path: /tmp/vncserver.tar
+ state: absent
diff --git a/ansible/test/roles/prepare-application/defaults/main.yml b/ansible/test/roles/prepare-application/defaults/main.yml
index 227bd4f0..c3883c65 100644
--- a/ansible/test/roles/prepare-application/defaults/main.yml
+++ b/ansible/test/roles/prepare-application/defaults/main.yml
@@ -1,4 +1,6 @@
---
simulate_helm: true
app_helm_charts_install_directory: application/helm_charts
-helm_simulation_output_file: /tmp/helm_simu_output \ No newline at end of file
+helm_simulation_output_file: /tmp/helm_simu_output
+application_pre_install_role: application/test-patch-role
+application_post_install_role: application/test-patch-role
diff --git a/ansible/test/roles/prepare-application/tasks/main.yml b/ansible/test/roles/prepare-application/tasks/main.yml
index 2f143a07..75abb802 100644
--- a/ansible/test/roles/prepare-application/tasks/main.yml
+++ b/ansible/test/roles/prepare-application/tasks/main.yml
@@ -1,9 +1,14 @@
---
-- name: Create Application helm charts directory
+- name: Create application role mocked artifacts directories
file:
- path: "{{ app_helm_charts_install_directory }}"
+ path: "{{ item }}"
state: directory
delegate_to: localhost
+ loop:
+ - "{{ app_helm_charts_install_directory }}"
+ - certs
+ - "{{ application_pre_install_role + '/tasks/' }}"
+ - "{{ application_post_install_role + '/tasks/' }}"
- name: Create Makefile to simulate helm charts dir and make building
copy:
@@ -33,15 +38,19 @@
name: make
state: present
-- name: Create local certs dir for dummy certs
- file:
- path: certs
- state: directory
- delegate_to: localhost
-
- name: Create dummy cert file to simulate offline server certificates in helm install with override.yml file
copy:
content: |
this is dummy server certificate value
dest: certs/rootCA.crt
delegate_to: localhost
+
+- name: Create test patch role files
+ copy:
+ content: |
+ ---
+ - name: Mocked up patch role
+ debug:
+ msg: "Noop task to mock up patch role"
+ dest: application/test-patch-role/tasks/main.yml
+ delegate_to: localhost
diff --git a/ansible/test/roles/prepare-helm/defaults/main.yml b/ansible/test/roles/prepare-helm/defaults/main.yml
deleted file mode 100644
index 8ab9ed3a..00000000
--- a/ansible/test/roles/prepare-helm/defaults/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-# Helm version to download.
-helm_version: 2.12.3
diff --git a/ansible/test/roles/prepare-helm/tasks/main.yml b/ansible/test/roles/prepare-helm/tasks/main.yml
index aa01e281..1f461258 100644
--- a/ansible/test/roles/prepare-helm/tasks/main.yml
+++ b/ansible/test/roles/prepare-helm/tasks/main.yml
@@ -5,14 +5,8 @@
recurse: true
state: directory
-- name: "Download and unarchive helm-{{ helm_version }}"
- unarchive:
- src: "https://get.helm.sh/helm-v{{ helm_version }}-linux-amd64.tar.gz"
- dest: "/tmp"
- remote_src: true
-
-- name: "Copy helm binary"
- copy:
- src: /tmp/linux-amd64/helm
- dest: "{{ app_data_path }}/downloads/helm"
+- name: "Download helm-{{ helm_version }}"
+ get_url:
+ url: "https://get.helm.sh/helm-{{ helm_version }}-linux-amd64.tar.gz"
+ dest: "{{ app_data_path }}/downloads"
remote_src: true
diff --git a/ansible/test/roles/prepare-nexus/defaults/main.yml b/ansible/test/roles/prepare-nexus/defaults/main.yml
new file mode 100644
index 00000000..4e76f603
--- /dev/null
+++ b/ansible/test/roles/prepare-nexus/defaults/main.yml
@@ -0,0 +1,12 @@
+---
+prepare_nexus_images:
+ - name: "{{ nexus3_image }}" # name already contains tag so it's ommited in this list element
+ archive_path: /tmp/nexus.tar
+ dest: "{{ infra_images_path }}/{{ nexus3_image_tar }}"
+ - name: nexus3.onap.org:10001/busybox
+ tag: latest
+ archive_path: /tmp/busybox.tar
+ dest: "{{ aux_data_path }}/busybox.tar"
+ - name: nexus3.onap.org:10001/library/alpine
+ archive_path: /tmp/alpine.tar
+ dest: "{{ aux_data_path }}/alpine.tar"
diff --git a/ansible/test/roles/prepare-nexus/tasks/main.yml b/ansible/test/roles/prepare-nexus/tasks/main.yml
index 4ef40f5e..951bc28e 100644
--- a/ansible/test/roles/prepare-nexus/tasks/main.yml
+++ b/ansible/test/roles/prepare-nexus/tasks/main.yml
@@ -18,53 +18,16 @@
- "{{ infra_images_path }}"
- "{{ aux_data_path }}"
-- name: Download and archive nexus docker image for the nexus role to use
+- name: Download and archive docker images for the nexus role to use
delegate_to: localhost
docker_image:
- name: "{{ nexus3_image }}"
- archive_path: /tmp/nexus.tar
+ name: "{{ item.name }}"
+ tag: "{{ item.tag | default('latest') }}" # Tag given in 'name' has precedence over the one declared here
+ archive_path: "{{ item.archive_path }}"
+ loop: "{{ prepare_nexus_images }}"
-- 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
+- name: Copy docker images to node
copy:
- src: /tmp/haproxy.tar
- dest: "{{ aux_data_path }}/aaionap-haproxy.tar"
+ src: "{{ item.archive_path }}"
+ dest: "{{ item.dest }}"
+ loop: "{{ prepare_nexus_images }}"
diff --git a/ansible/test/roles/prepare-rke/tasks/infra.yml b/ansible/test/roles/prepare-rke/tasks/infra.yml
index 55ab7f16..e9971f77 100644
--- a/ansible/test/roles/prepare-rke/tasks/infra.yml
+++ b/ansible/test/roles/prepare-rke/tasks/infra.yml
@@ -7,7 +7,7 @@
- name: "Install rke-{{ rke_version }}"
get_url:
url: "https://github.com/rancher/rke/releases/download/v{{ rke_version }}/rke_linux-amd64"
- dest: "{{ app_data_path }}/downloads/rke"
+ dest: "{{ app_data_path }}/downloads/rke_linux-amd64"
- name: "Install kubectl-{{ kubectl_version }}"
get_url: