-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Upload local ISO file to Datastore | ||
hosts: all | ||
gather_facts: false | ||
|
||
roles: | ||
- role: cloud.vmware_ops.upload_iso_to_datastore |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
upload_iso_to_datastore_hostname: "{{ vmware_ops_collection_hostname }}" | ||
upload_iso_to_datastore_username: "{{ vmware_ops_collection_username }}" | ||
upload_iso_to_datastore_password: "{{ vmware_ops_collection_password }}" | ||
upload_iso_to_datastore_validate_certs: "{{ vmware_ops_collection_validate_certs }}" | ||
upload_iso_to_datastore_port: "{{ vmware_ops_collection_port }}" | ||
|
||
upload_iso_to_datastore_proxy_host: "{{ vmware_ops_collection_proxy_host }}" | ||
upload_iso_to_datastore_proxy_port: "{{ vmware_ops_collection_proxy_port }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
galaxy_info: | ||
author: Ansible Cloud Content Team (@redhat-cop) | ||
description: Manage a content library in vCenter | ||
company: Red Hat, Inc. | ||
license: GPL-3.0-or-later | ||
min_ansible_version: "2.13" | ||
galaxy_tags: | ||
- infrastructure | ||
- vmware | ||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- name: Import Collection Level Vars | ||
ansible.builtin.include_vars: | ||
file: "{{ role_path }}/../../vars/main.yml" | ||
|
||
- name: Check Mandatory Variables Are Defined | ||
ansible.builtin.assert: | ||
that: | ||
- upload_iso_to_datastore_hostname is defined | ||
- upload_iso_to_datastore_username is defined | ||
- upload_iso_to_datastore_password is defined | ||
- upload_iso_to_datastore_datastore is defined | ||
quiet: true | ||
fail_msg: Variable must be set when using this role. | ||
|
||
- name: Upload local ISO file to Datastore | ||
community.vmware.vsphere_copy: | ||
hostname: "{{ upload_iso_to_datastore_hostname }}" | ||
username: "{{ upload_iso_to_datastore_username }}" | ||
password: "{{ upload_iso_to_datastore_password }}" | ||
src: "{{ upload_iso_to_datastore_src }}" | ||
datacenter: "{{ upload_iso_to_datastore_datacenter }}" | ||
datastore: "{{ upload_iso_to_datastore_datastore }}" | ||
path: "{{ upload_iso_to_datastore_dst}}" | ||
validate_certs: false |
15 changes: 15 additions & 0 deletions
15
tests/integration/targets/vmware_ops_upload_iso_to_datastore_test/run.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
- hosts: localhost | ||
gather_facts: no | ||
|
||
tasks: | ||
- name: Import eco-vcenter credentials | ||
ansible.builtin.include_vars: | ||
file: ../../integration_config.yml | ||
tags: eco-vcenter-ci | ||
|
||
- name: Import Upload ISO to Datastore role | ||
ansible.builtin.import_role: | ||
name: vmware_ops_upload_iso_to_datastore_test | ||
tags: | ||
- eco-vcenter-ci |
60 changes: 60 additions & 0 deletions
60
tests/integration/targets/vmware_ops_upload_iso_to_datastore_test/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
- name: Test | ||
when: not run_on_simulator | ||
block: | ||
- name: Import common vars | ||
ansible.builtin.include_vars: | ||
file: ../group_vars.yml | ||
|
||
- name: Create ISO Mocks | ||
block: | ||
- name: Mock VCSA Binary | ||
ansible.builtin.include_tasks: mock_vcsa_binary.yml | ||
always: | ||
- name: Clean Up Temp Files | ||
ansible.builtin.file: | ||
path: "{{ provision_vcenter_test_mock_binary_root }}" | ||
state: absent | ||
|
||
- name: Test ISO Upload to Datastore | ||
block: | ||
- name: Upload ISO to Datastore | ||
ansible.builtin.import_role: | ||
name: cloud.vmware_ops.upload_iso_to_datastore | ||
|
||
- name: Attempt to recreate ISO file | ||
community.vmware.vsphere_file: | ||
hostname: '{{ upload_iso_to_datastore_hostname }}' | ||
username: '{{ upload_iso_to_datastore_username }}' | ||
password: '{{ upload_iso_to_datastore_password }}' | ||
datacenter: "{{ upload_iso_to_datastore_datacenter }}" | ||
datastore: "{{ upload_iso_to_datastore_datastore }}" | ||
path: "{{ upload_iso_to_datastore_dst }}" | ||
state: file | ||
validate_certs: false | ||
ignore_errors: true | ||
register: file_result | ||
|
||
- name: Check ISO was copied to Datastore | ||
ansible.builtin.assert: | ||
that: | ||
- file_result.changed is false | ||
quiet: true | ||
fail_msg: Copy of ISO was unsuccessful | ||
|
||
always: | ||
- name: Clean Up Temp ISO | ||
ansible.builtin.file: | ||
path: "{{ upload_iso_to_datastore_src }}" | ||
state: absent | ||
|
||
- name: Delete ISO file from Datastore | ||
community.vmware.vsphere_file: | ||
hostname: "{{ upload_iso_to_datastore_hostname }}" | ||
username: "{{ upload_iso_to_datastore_username }}" | ||
password: "{{ upload_iso_to_datastore_password }}" | ||
state: absent | ||
datacenter: "{{ upload_iso_to_datastore_datacenter }}" | ||
datastore: "{{ upload_iso_to_datastore_datastore }}" | ||
path: "{{ upload_iso_to_datastore_dst}}" | ||
validate_certs: false |
12 changes: 12 additions & 0 deletions
12
tests/integration/targets/vmware_ops_upload_iso_to_datastore_test/tasks/mock_vcsa_binary.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Create Mock VCSA Deployment Binary Path | ||
ansible.builtin.file: | ||
path: "{{ provision_vcenter_test_mock_binary_root }}/lin64" | ||
state: directory | ||
|
||
- name: Create Mock VCSA ISO file | ||
community.general.iso_create: | ||
src_files: | ||
- "{{ provision_vcenter_test_mock_binary_root }}" | ||
dest_iso: "{{ upload_iso_to_datastore_src }}" | ||
interchange_level: 4 |
9 changes: 9 additions & 0 deletions
9
tests/integration/targets/vmware_ops_upload_iso_to_datastore_test/vars/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
run_on_simulator: false | ||
|
||
upload_iso_to_datastore_datacenter: "{{ vcenter_datacenter }}" | ||
upload_iso_to_datastore_datastore: "{{ shared_storage_01 }}" | ||
upload_iso_to_datastore_src: "/tmp/test.iso" | ||
upload_iso_to_datastore_dst: "/test.iso" | ||
|
||
provision_vcenter_test_mock_binary_root: /tmp/vcsa-cli-installer |