summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYanis Guenane <yanis@guenane.org>2018-07-16 14:56:26 +0200
committerYanis Guenane <yanis@guenane.org>2018-07-16 15:09:59 +0200
commitffe0eac858ed4d866c45ff8fa80c58c11d70722b (patch)
tree44fe964ddc54c037d754553d9d62aec548326add
parent9c096b99a03c834ccc1de118234469cb77e447a1 (diff)
Improve testing scenarios
Change-Id: Ia9f59738f4b2bbe4a9b59b0660a879b5958ae387
-rw-r--r--tasks/openstack/main.yml4
-rw-r--r--tests/inventory/group_vars/all5
-rw-r--r--tests/inventory/host_vars/amazon1
-rw-r--r--tests/inventory/host_vars/openstack1
-rw-r--r--tests/inventory/hosts4
-rw-r--r--tests/main.yml13
6 files changed, 21 insertions, 7 deletions
diff --git a/tasks/openstack/main.yml b/tasks/openstack/main.yml
index 1df9360..4b21443 100644
--- a/tasks/openstack/main.yml
+++ b/tasks/openstack/main.yml
@@ -1,7 +1,7 @@
---
-- name: Create volume
+- name: Manage volume
os_volume:
display_name: '{{ cloud_volume_name }}'
size: '{{ cloud_volume_size }}'
- region_name: '{{ cloud_volume_region }}'
+ availability_zone: '{{ cloud_volume_region }}'
state: '{{ cloud_volume_state|default("present") }}'
diff --git a/tests/inventory/group_vars/all b/tests/inventory/group_vars/all
new file mode 100644
index 0000000..abec44f
--- /dev/null
+++ b/tests/inventory/group_vars/all
@@ -0,0 +1,5 @@
+ansible_host: localhost
+ansible_connection: local
+
+cloud_volume_name: ansiblecloud-testvolume
+cloud_volume_size: 10
diff --git a/tests/inventory/host_vars/amazon b/tests/inventory/host_vars/amazon
new file mode 100644
index 0000000..e210b61
--- /dev/null
+++ b/tests/inventory/host_vars/amazon
@@ -0,0 +1 @@
+cloud_volume_region: 'eu-west-1:eu-west-1a'
diff --git a/tests/inventory/host_vars/openstack b/tests/inventory/host_vars/openstack
new file mode 100644
index 0000000..41a59c3
--- /dev/null
+++ b/tests/inventory/host_vars/openstack
@@ -0,0 +1 @@
+cloud_volume_region: nova
diff --git a/tests/inventory/hosts b/tests/inventory/hosts
new file mode 100644
index 0000000..83fa54a
--- /dev/null
+++ b/tests/inventory/hosts
@@ -0,0 +1,4 @@
+digitalocean
+amazon
+openstack
+vultr
diff --git a/tests/main.yml b/tests/main.yml
index 0b4fa74..5d1a0f5 100644
--- a/tests/main.yml
+++ b/tests/main.yml
@@ -1,19 +1,22 @@
---
- hosts: localhost
tasks:
+ - name: Determine platform for which to run the tests
+ set_fact:
+ host: "{{ lookup('env', 'ANSIBLE_CLOUD_PROVIDER') }}"
+
+- name: Running tests for '{{ hostvars.localhost.host }}'
+ hosts: '{{ hostvars.localhost.host }}'
+ tasks:
- name: Create volume
include_role:
name: ansible-role-cloud-volume
vars:
ansible_cloud_provider: "{{ lookup('env', 'ANSIBLE_CLOUD_PROVIDER') }}"
- cloud_volume_name: ansiblecloud-testvolume
- cloud_volume_size: 20
- cloud_volume_region: AMS3
- name: Delete volume
include_role:
name: ansible-role-cloud-volume
vars:
ansible_cloud_provider: "{{ lookup('env', 'ANSIBLE_CLOUD_PROVIDER') }}"
- cloud_volume_name: ansiblecloud-testvolume
- cloud_server_state: absent
+ cloud_volume_state: absent