-
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.
use collection and environment variables as fallbacks for common auth…
… vars across all roles (#108) * use collection and environment variables as fallbacks for common auth vars across all roles
- Loading branch information
1 parent
1f3b50c
commit 73e061f
Showing
91 changed files
with
764 additions
and
418 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,5 @@ | ||
--- | ||
minor_changes: | ||
- >- | ||
Added the option to set environment variables or collection level variables for auth to vcenter. This provides users | ||
with a more centralizedoption for setting things that all roles use like vCenter hostname, username, password, etc |
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,67 @@ | ||
# Authentication Variables | ||
|
||
Each role in this collection has its own set of authentication and proxy variables. It is not convnient to set those variables for every role, so there are options to set the variables for all roles in the collection at once. | ||
|
||
Here is the order of precedence from greatest to least (the first listed variables override all other variables): | ||
|
||
1. Role variables (for example, `info_hostname` for the `info` role) | ||
2. Collection level variables (for example, `vmware_ops_hostname`) | ||
3. Environment variables (for example, `VMWARE_HOST`) | ||
|
||
## Collection and Environment Variables | ||
|
||
The list of collection/environment variables is pulled from the [vars/main.yml](https://github.com/redhat-cop/cloud.vmware_ops/blob/main/vars/main.yml) | ||
|
||
The available collection level variables and their corresponding environment variables can be found below: | ||
|
||
- vmware_ops_hostname | ||
* str, The hostname or IP address of the vSphere vCenter or ESXi host to manage. | ||
* Environment Var: `VMWARE_HOST` | ||
|
||
- vmware_ops_username | ||
* str, The username to use when authenticating to the vSphere vCenter or ESXi host. | ||
* Environment Var: `VMWARE_USER` | ||
|
||
- vmware_ops_password | ||
* str, The password to use when authenticating to the vSphere vCenter or ESXi host. | ||
* Environment Var: `VMWARE_PASSWORD` | ||
|
||
- vmware_ops_validate_certs | ||
* bool, Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted. | ||
* Environment Var: `VMWARE_VALIDATE_CERTS` | ||
|
||
- vmware_ops_port | ||
* int, The port to use when authenticating to the vSphere vCenter or ESXi host to manage. | ||
* Environment Var: `VMWARE_PORT` | ||
|
||
- vmware_ops_proxy_host | ||
* str, The hostname or IP address of a proxy host to use. If set all requests to the vCenter or ESXi host will go through the proxy host. | ||
* Environment Var: `VMWARE_PROXY_HOST` | ||
|
||
- vmware_ops_proxy_port | ||
* int, The port of a proxy host to use. If set all requests to the vCenter or ESXi host will go through the proxy host. | ||
* Environment Var: `VMWARE_PROXY_PORT` | ||
|
||
## Example Playbook | ||
|
||
```yaml | ||
- name: Example Of Setting Different variables | ||
hosts: localhost | ||
environment: | ||
VMWARE_HOST: myvcenter.local | ||
VMWARE_USER: myadmin | ||
|
||
vars: | ||
# You can avoid exposing the password as an environment variable, and leverage ansible-vault by using the collection level | ||
# variable instead | ||
vmware_ops_password: vaultedPassword! | ||
|
||
roles: | ||
# This role will use VMWARE_HOST, VMWARE_USER, and vmware_ops_password | ||
- role: cloud.vmware_ops.provision_vm | ||
|
||
# This role will use VMWARE_HOST, info_username, and info_password | ||
- role: cloud.vmware_ops.info | ||
info_username: myreader | ||
info_password: readerPassword! | ||
``` |
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
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 |
---|---|---|
@@ -1,2 +1,11 @@ | ||
--- | ||
cluster_settings_hostname: "{{ vmware_ops_collection_hostname }}" | ||
cluster_settings_username: "{{ vmware_ops_collection_username }}" | ||
cluster_settings_password: "{{ vmware_ops_collection_password }}" | ||
cluster_settings_validate_certs: "{{ vmware_ops_collection_validate_certs }}" | ||
cluster_settings_port: "{{ vmware_ops_collection_port }}" | ||
|
||
cluster_settings_proxy_host: "{{ vmware_ops_collection_proxy_host }}" | ||
cluster_settings_proxy_port: "{{ vmware_ops_collection_proxy_port }}" | ||
|
||
cluster_settings_drs_apply_recommendations: false |
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
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
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 |
---|---|---|
@@ -1,2 +1,11 @@ | ||
--- | ||
content_library_hostname: "{{ vmware_ops_collection_hostname }}" | ||
content_library_username: "{{ vmware_ops_collection_username }}" | ||
content_library_password: "{{ vmware_ops_collection_password }}" | ||
content_library_validate_certs: "{{ vmware_ops_collection_validate_certs }}" | ||
content_library_port: "{{ vmware_ops_collection_port }}" | ||
|
||
content_library_proxy_host: "{{ vmware_ops_collection_proxy_host }}" | ||
content_library_proxy_port: "{{ vmware_ops_collection_proxy_port }}" | ||
|
||
content_library_state: present |
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
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
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 @@ | ||
--- | ||
deploy_ovf_hostname: "{{ vmware_ops_collection_hostname }}" | ||
deploy_ovf_username: "{{ vmware_ops_collection_username }}" | ||
deploy_ovf_password: "{{ vmware_ops_collection_password }}" | ||
deploy_ovf_validate_certs: "{{ vmware_ops_collection_validate_certs }}" | ||
deploy_ovf_port: "{{ vmware_ops_collection_port }}" | ||
|
||
deploy_ovf_proxy_host: "{{ vmware_ops_collection_proxy_host }}" | ||
deploy_ovf_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
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
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 |
---|---|---|
@@ -1,2 +1,11 @@ | ||
--- | ||
esxi_maintenance_mode_hostname: "{{ vmware_ops_collection_hostname }}" | ||
esxi_maintenance_mode_username: "{{ vmware_ops_collection_username }}" | ||
esxi_maintenance_mode_password: "{{ vmware_ops_collection_password }}" | ||
esxi_maintenance_mode_validate_certs: "{{ vmware_ops_collection_validate_certs }}" | ||
esxi_maintenance_mode_port: "{{ vmware_ops_collection_port }}" | ||
|
||
esxi_maintenance_mode_proxy_host: "{{ vmware_ops_collection_proxy_host }}" | ||
esxi_maintenance_mode_proxy_port: "{{ vmware_ops_collection_proxy_port }}" | ||
|
||
esxi_maintenance_mode_enable: true |
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
Oops, something went wrong.