Use the original playbook in play-resources tests
This commit includes the original resources.yml playbook
by using import_playbook.
Some modifications were needed mostly because of the way
import_playbook works.
Also moved the setup role call to prepare.
Change-Id: I8745d5e43fd2050d47970c7d19bbbc4db8a5847f
Issue-ID: OOM-1912
Signed-off-by: Michal Zegan <m.zegan@samsung.com>
diff --git a/ansible/test/play-resources/molecule/default/playbook.yml b/ansible/test/play-resources/molecule/default/playbook.yml
index 50ba233..096077a 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 a443600..5c8ae65 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
similarity index 87%
rename from ansible/test/play-resources/molecule/default/group_vars/all.yml
rename to ansible/test/play-resources/molecule/default/vars.yml
index 558eacb..46ab3e0 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 9cff6b8..1172639 100644
--- a/ansible/test/play-resources/molecule/nfs/molecule.yml
+++ b/ansible/test/play-resources/molecule/nfs/molecule.yml
@@ -32,13 +32,8 @@
- 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 8844011..096077a 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 d381ba7..2276f2e 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/default/group_vars/all.yml b/ansible/test/play-resources/molecule/nfs/vars.yml
similarity index 67%
copy from ansible/test/play-resources/molecule/default/group_vars/all.yml
copy to ansible/test/play-resources/molecule/nfs/vars.yml
index 558eacb..2cc4d25 100644
--- a/ansible/test/play-resources/molecule/default/group_vars/all.yml
+++ b/ansible/test/play-resources/molecule/nfs/vars.yml
@@ -1,7 +1,7 @@
---
-app_data_path: /opt/myleculeapp
+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
-ansible_ssh_private_key_file: ~/.ssh/offline_ssh_key