Skip to content

Commit

Permalink
move datacenter out of auth vars for manage_folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemorency committed Oct 8, 2024
1 parent 7e8fbfd commit b89a126
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- manage_folder - Fixed the location of variables in docs to match other roles
- manage_folder - Updated datacenter var name to match other roles while keeping backwards compat
7 changes: 4 additions & 3 deletions roles/manage_folder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ N/A
- **manage_folder_validate_certs**
- Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.

- **manage_folder_datacenter_name**:
- The name of the datacenter in vSphere vCenter which contains the cluster to configure.

- **manage_folder_port**:
- str or int, The port used to authenticate to the vSphere vCenter that contains the cluster to configure.

### Other
- **manage_folder_datacenter**:
- The name of the datacenter in vSphere vCenter which contains the cluster to configure.
- Aliases: [manage_folder_datacenter]

- **manage_folder_folder_name**:
- str, required, The name of folder to manage. It can be a single name like `foo` or a path like `foo/bar/buzz`.

Expand Down
7 changes: 6 additions & 1 deletion roles/manage_folder/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Check Mandatory Variables Are Defined
ansible.builtin.assert:
that:
- manage_folder_datacenter_name is defined
- manage_folder_datacenter is defined or manage_folder_datacenter_name is defined
- manage_folder_folder_name is defined and ((manage_folder_folder_name | length) > 0)
- manage_folder_hostname is defined
- manage_folder_username is defined
Expand All @@ -15,6 +15,11 @@
msg: Folder name should not be absolute. It should be relative to /<datacenter>/<type>
when: manage_folder_folder_name[0] == '/'

- name: Map Variable Aliases to Documented Names
ansible.builtin.set_fact:
manage_folder_datacenter: "{{ manage_folder_datacenter_name }}"
when: manage_folder_datacenter_name is defined

- name: Manage Full Folder Path
when: manage_folder_parse_name_as_path
block:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
hostname: "{{ manage_folder_hostname }}"
username: "{{ manage_folder_username }}"
password: "{{ manage_folder_password }}"
datacenter: "{{ manage_folder_datacenter_name }}"
datacenter: "{{ manage_folder_datacenter }}"
port: "{{ manage_folder_port }}"
validate_certs: false
delegate_to: localhost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ manage_folder_username: "test"
manage_folder_password: "test"
manage_folder_validate_certs: false
manage_folder_port: "8989"
manage_folder_datacenter_name: DC0
manage_folder_datacenter: DC0
folder_types:
- host
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ manage_folder_username: "{{ vcenter_username }}"
manage_folder_password: "{{ vcenter_password }}"
manage_folder_validate_certs: false
manage_folder_port: "{{ vcenter_port }}"
manage_folder_datacenter_name: "{{ vcenter_datacenter }}"
manage_folder_datacenter: "{{ vcenter_datacenter }}"
folder_types:
- host
- vm
Expand Down

0 comments on commit b89a126

Please sign in to comment.