Skip to content

Commit

Permalink
Merge pull request redhat-cop#99 from mikemorency/mm-bugfix/deploy-ov…
Browse files Browse the repository at this point in the history
…f-template-required-var

deploy_ovf_template should not always be mandatory
  • Loading branch information
mikemorency authored Sep 11, 2024
2 parents f5a2310 + 9f39576 commit 121353e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/99_deploy_ovf_template_required_var.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- deploy_ovf - Fixed the pre-check assertions for deploy_ovf_template var since it is required with content libraries and optional otherwise
16 changes: 12 additions & 4 deletions roles/deploy_ovf/tasks/input_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@
quiet: true
fail_msg: Variable must be set when using this role.

- name: Check Deployment Variables
- name: Check Non-Library OVF Deployment Variables
ansible.builtin.assert:
that: >-
(deploy_ovf_url is defined and (deploy_ovf_template is not defined and deploy_ovf_library is not defined)) or
(deploy_ovf_url is not defined and (deploy_ovf_template is defined or deploy_ovf_library is defined))
(deploy_ovf_url is defined and deploy_ovf_template is not defined) or
(deploy_ovf_url is not defined and deploy_ovf_template is defined)
quiet: true
fail_msg: deploy_ovf_url is mutually exclusive with deploy_ovf_template and deploy_ovf_library.
fail_msg: One of deploy_ovf_url or deploy_ovf_template is required when deploy_ovf_library is not used.
when: deploy_ovf_library is not defined

- name: Check Content Library Deployment Variables
ansible.builtin.assert:
that: deploy_ovf_template is defined
quiet: true
fail_msg: deploy_ovf_template is required when deploy_ovf_library is defined.
when: deploy_ovf_library is defined

- name: Check Datastore Variables
ansible.builtin.assert:
Expand Down
2 changes: 1 addition & 1 deletion roles/deploy_ovf/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
cluster: "{{ deploy_ovf_cluster_name | default(omit) }}"

name: "{{ deploy_ovf_vm_name }}"
ovf: "{{ deploy_ovf_template }}"
ovf: "{{ deploy_ovf_template | default(omit) }}"
esxi_hostname: "{{ deploy_ovf_esxi_host | default(omit) }}"
folder: "{{ deploy_ovf_folder | default(omit) }}"
resource_pool: "{{ deploy_ovf_resource_pool | default(omit) }}"
Expand Down

0 comments on commit 121353e

Please sign in to comment.