summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/intersight/playbooks/roles
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:04:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:04:41 +0000
commit975f66f2eebe9dadba04f275774d4ab83f74cf25 (patch)
tree89bd26a93aaae6a25749145b7e4bca4a1e75b2be /ansible_collections/cisco/intersight/playbooks/roles
parentInitial commit. (diff)
downloadansible-975f66f2eebe9dadba04f275774d4ab83f74cf25.tar.xz
ansible-975f66f2eebe9dadba04f275774d4ab83f74cf25.zip
Adding upstream version 7.7.0+dfsg.upstream/7.7.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cisco/intersight/playbooks/roles')
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/auto_support/tasks/main.yml31
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_network/tasks/main.yml50
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/defaults/main.yml8
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/tasks/main.yml33
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_storage/tasks/main.yml34
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/deploy/tasks/main.yml43
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_network/tasks/main.yml38
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/defaults/main.yml6
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/tasks/main.yml31
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_storage/tasks/main.yml31
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_software_version/tasks/main.yml30
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/fc/tasks/main.yml52
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/intersight_org/tasks/main.yml17
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/iscsi/tasks/main.yml38
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/local_credential/tasks/main.yml33
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_config/tasks/main.yml42
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_profiles/tasks/main.yml49
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/proxy/tasks/main.yml31
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/software_version/tasks/main.yml31
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/sys_config/tasks/main.yml33
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/vcenter/tasks/main.yml33
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml40
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/servers/actions/tasks/main.yml30
23 files changed, 764 insertions, 0 deletions
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/auto_support/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/auto_support/tasks/main.yml
new file mode 100644
index 000000000..f25e88573
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/auto_support/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+- name: "Configure Auto Support Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/AutoSupportPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_auto_support_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name": "{{ hx_auto_support_policy }}",
+ "AdminState":"{{ hx_auto_support_enable }}",
+ "ServiceTicketReceipient":"{{ hx_auto_support_receipient }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: auto_support_policy
+
+- debug: msg="HyperFlex Autosupport Policy named {{ hx_auto_support_policy }} has been created successfully." \ No newline at end of file
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_network/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_network/tasks/main.yml
new file mode 100644
index 000000000..8209117f3
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_network/tasks/main.yml
@@ -0,0 +1,50 @@
+---
+- name: "Configure Cluster Network Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterNetworkPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_network_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_cluster_network_policy }}",
+ "JumboFrame":"{{ hx_jumbo_frames }}",
+ "KvmIpRange":{
+ "StartAddr":"{{ ucs_kvm_start_ip }}",
+ "EndAddr":"{{ ucs_kvm_end_ip }}",
+ "Gateway":"{{ ucs_kvm_gateway }}",
+ "Netmask":"{{ ucs_kvm_netmask }}"
+ },
+ "MacPrefixRange":{
+ "StartAddr":"{{ hx_mac_start }}",
+ "EndAddr":"{{ hx_mac_end }}"
+ },
+ "MgmtVlan":{
+ "Name":"{{ hx_mgmt_vlan_name }}",
+ "VlanId":"{{ hx_mgmt_vlan_id }}"
+ },
+ "VmMigrationVlan":{
+ "Name":"{{ hx_migration_vlan_name }}",
+ "VlanId":"{{ hx_migration_vlan_id }}"
+ },
+ "VmNetworkVlans":"{{ hx_guest_vm_vlans }}",
+ "UplinkSpeed": "default",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: cluster_network
+
+- debug: msg="HyperFlex Cluster Network Policy named {{ hx_cluster_network_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/defaults/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/defaults/main.yml
new file mode 100644
index 000000000..a7a0ca669
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/defaults/main.yml
@@ -0,0 +1,8 @@
+---
+# Default variable values for HyperFlex Cluster Profiles
+hx_mgmt_platform: FI
+hx_hypervisor_type: ESXi
+hx_replication_factor: 3
+hx_vdi_optimization: false
+hx_disk_cleanup: false
+hx_laz_autoconfig: false
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/tasks/main.yml
new file mode 100644
index 000000000..877f41f1b
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: "Configure Cluster Profile"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterProfiles
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_profile }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_cluster_profile }}",
+ "MgmtPlatform":"{{ hx_mgmt_platform }}",
+ "HypervisorType":"{{ hx_hypervisor_type }}",
+ "MgmtIpAddress":"{{ hx_mgmt_ip }}",
+ "MacAddressPrefix":"{{ hx_mgmt_mac_prefix }}",
+ "Replication":"{{ hx_replication_factor }}",
+ "StorageDataVlan":{
+ "Name":"{{ hx_data_vlan_name }}",
+ "VlanId":"{{ hx_data_vlan_id }}"
+ }
+ }
+ register: cluster_profile
+
+- debug: msg="HyperFlex Cluster Profile named {{ hx_cluster_profile }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_storage/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_storage/tasks/main.yml
new file mode 100644
index 000000000..efd14093d
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_storage/tasks/main.yml
@@ -0,0 +1,34 @@
+---
+- name: "Configure Cluster Storage Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterStoragePolicies
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_storage_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_cluster_storage_policy }}",
+ "VdiOptimization":"{{ hx_vdi_optimization }}",
+ "DiskPartitionCleanup":"{{ hx_disk_cleanup }}",
+ "LogicalAvalabilityZoneConfig":{
+ "AutoConfig":"{{ hx_laz_autoconfig }}"
+ },
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: storage_setting
+
+- debug: msg="HyperFlex Cluster Storage Policy named {{ hx_cluster_storage_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/deploy/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/deploy/tasks/main.yml
new file mode 100644
index 000000000..13b598b65
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/deploy/tasks/main.yml
@@ -0,0 +1,43 @@
+---
+# Get cluster profile
+- name: Get Cluster Profile
+ vars:
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterProfiles
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_name }}'"
+ register: profile
+# Prompt for cluster deployment action
+- name: "Prompt for deployment action"
+ pause:
+ prompt: "Set the deployment action. Valid choices are Validate, Deploy, Continue or Retry."
+ echo: yes
+ register: hx_action
+ run_once: true
+# Set cluster deployment action
+- name: Set Cluster Action
+ vars:
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterProfiles
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_name }}'"
+ api_body: {
+ "Action": "{{ hx_action.user_input }}"
+ }
+ when:
+ - profile.api_response.ConfigContext.ConfigState != 'Configuring'
+ - profile.api_response.ConfigContext.ConfigState != 'Associated'
+# Can optionally wait for subsequent tasks if needed
+# register: result
+# until: result.api_response.config_context.config_state == 'Associated'
+# retries: 20
+# delay: 30
+- debug: msg="HyperFlex Cluster Profile deployment action has been triggered successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_network/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_network/tasks/main.yml
new file mode 100644
index 000000000..7dcc57a58
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_network/tasks/main.yml
@@ -0,0 +1,38 @@
+---
+- name: "Configure Cluster Network Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterNetworkPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_network_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_cluster_network_policy }}",
+ "JumboFrame":"{{ hx_jumbo_frames }}",
+ "MacPrefixRange":{
+ "StartAddr":"{{ hx_mac_start }}",
+ "EndAddr":"{{ hx_mac_end }}"
+ },
+ "MgmtVlan":{
+ "VlanId":"{{ hx_mgmt_vlan_id }}"
+ },
+ "UplinkSpeed":"{{ hx_uplink_speed }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: cluster_network
+
+- debug: msg="HyperFlex Cluster Network Policy named {{ hx_cluster_network_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/defaults/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/defaults/main.yml
new file mode 100644
index 000000000..7ace5ad50
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/defaults/main.yml
@@ -0,0 +1,6 @@
+---
+# Default variable values for HyperFlex Cluster Profiles
+hx_mgmt_platform: EDGE
+hx_hypervisor_type: ESXi
+hx_vdi_optimization: false
+hx_disk_cleanup: false
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/tasks/main.yml
new file mode 100644
index 000000000..6beef6e58
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+- name: "Configure Cluster Profile"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterProfiles
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_profile }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_cluster_profile }}",
+ "MgmtPlatform":"{{ hx_mgmt_platform }}",
+ "HypervisorType":"{{ hx_hypervisor_type }}",
+ "MgmtIpAddress":"{{ hx_mgmt_ip }}",
+ "MacAddressPrefix":"{{ hx_mgmt_mac_prefix }}",
+ "StorageDataVlan":{
+ "VlanId":"{{ hx_data_vlan_id }}"
+ }
+ }
+ register: cluster_profile
+
+- debug: msg="HyperFlex Cluster Profile named {{ hx_cluster_profile }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_storage/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_storage/tasks/main.yml
new file mode 100644
index 000000000..ee9849288
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_storage/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+- name: "Configure Cluster Storage Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterStoragePolicies
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_storage_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_cluster_storage_policy }}",
+ "VdiOptimization":"{{ hx_vdi_optimization }}",
+ "DiskPartitionCleanup":"{{ hx_disk_cleanup }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: storage_setting
+
+- debug: msg="HyperFlex Cluster Storage Policy named {{ hx_cluster_storage_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_software_version/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_software_version/tasks/main.yml
new file mode 100644
index 000000000..32db3b017
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_software_version/tasks/main.yml
@@ -0,0 +1,30 @@
+---
+- name: "Configure Software Version Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/SoftwareVersionPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_software_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_software_policy }}",
+ "HxdpVersion":"{{ hxdp_version }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: software_policy
+
+- debug: msg="HyperFlex Software Version Policy named {{ hx_software_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/fc/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/fc/tasks/main.yml
new file mode 100644
index 000000000..073cf38e4
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/fc/tasks/main.yml
@@ -0,0 +1,52 @@
+---
+- name: "Configure External FC Storage Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ExtFcStoragePolicies
+ query_params:
+ $filter: "Name eq '{{ hx_fc_setting_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "AdminState":"{{ hx_fc_setting_enable }}",
+ "Name":"{{ hx_fc_setting_policy }}",
+ "ExtaTraffic":{
+ "Name":"{{ hx_vsan_a_name }}",
+ "VsanId":"{{ hx_vsan_a_id }}"
+ },
+ "ExtbTraffic":{
+ "Name":"{{ hx_vsan_b_name }}",
+ "VsanId":"{{ hx_vsan_b_id }}"
+ },
+ "WwxnPrefixRange":{
+ "StartAddr":"{{ hx_fc_wwxn_range_start }}",
+ "EndAddr":"{{ hx_fc_wwxn_range_end }}"
+ },
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: fc_settings
+# Set WWXN prefix for the cluster profile when additional FC HBAs are configured
+- name: "Perform Action on {{ hx_profile_name }} Profile"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterProfiles
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_name }}'"
+ api_body: {
+ "WwxnPrefix": "{{ hx_fc_wwxn_range_start }}"
+ }
+
+- debug: msg="HyperFlex External FC Storage Policy named {{ hx_fc_setting_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/intersight_org/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/intersight_org/tasks/main.yml
new file mode 100644
index 000000000..fcef95a82
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/intersight_org/tasks/main.yml
@@ -0,0 +1,17 @@
+---
+- name: "Retrieve Intersight Org"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /organization/Organizations
+ query_params:
+ $filter: "Name eq '{{ org_name }}'"
+
+ register: intersight_org
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/iscsi/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/iscsi/tasks/main.yml
new file mode 100644
index 000000000..45b7548d8
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/iscsi/tasks/main.yml
@@ -0,0 +1,38 @@
+---
+- name: "Configure External iSCSI Storage Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ExtIscsiStoragePolicies
+ query_params:
+ $filter: "Name eq '{{ hx_iscsi_setting_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "AdminState":"{{ hx_iscsi_setting_enable }}",
+ "Name":"{{ hx_iscsi_setting_policy }}",
+ "ExtaTraffic":{
+ "Name":"{{ hx_iscsi_vlan_a_name }}",
+ "VlanId":"{{ hx_iscsi_vlan_a_id }}"
+ },
+ "ExtbTraffic":{
+ "Name":"{{ hx_iscsi_vlan_b_name }}",
+ "VlanId":"{{ hx_iscsi_vlan_b_id }}"
+ },
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: iscsi_settings
+
+- debug: msg="HyperFlex External iSCSI Storage Policy named {{ hx_iscsi_setting_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/local_credential/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/local_credential/tasks/main.yml
new file mode 100644
index 000000000..901dac0f6
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/local_credential/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: "Configure Local Credential Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/LocalCredentialPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_local_credential_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name": "{{ hx_local_credential_policy }}",
+ "HypervisorAdmin":"{{ hx_hypervisor_admin }}",
+ "FactoryHypervisorPassword":"{{ hx_hypervisor_factory_password }}",
+ "HypervisorAdminPwd":"{{ hx_hypervisor_password | default(omit) }}",
+ "HxdpRootPwd":"{{ hx_dp_root_password | default(omit) }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: local_credential
+
+- debug: msg="HyperFlex Local Credential Policy named {{ hx_local_credential_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_config/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_config/tasks/main.yml
new file mode 100644
index 000000000..5910f951a
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_config/tasks/main.yml
@@ -0,0 +1,42 @@
+---
+- name: "Configure Node Configuration Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/NodeConfigPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_node_config_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_node_config_policy }}",
+ "NodeNamePrefix":"{{ hx_node_profile_prefix }}",
+ "MgmtIpRange":{
+ "StartAddr":"{{ esx_mgmt_ip_start }}",
+ "EndAddr":"{{ esx_mgmt_ip_end }}",
+ "Netmask":"{{ hx_mgmt_netmask }}",
+ "Gateway":"{{ hx_mgmt_gateway }}"
+ },
+ "HxdpIpRange":{
+ "StartAddr":"{{ hx_mgmt_vm_ip_start }}",
+ "EndAddr":"{{ hx_mgmt_vm_ip_end }}",
+ "Netmask":"{{ hx_mgmt_netmask }}",
+ "Gateway":"{{ hx_mgmt_gateway }}"
+ },
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: node_config
+
+- debug: msg="HyperFlex Node Configuration Policy named {{ hx_node_config_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_profiles/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_profiles/tasks/main.yml
new file mode 100644
index 000000000..4c7ae35c9
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_profiles/tasks/main.yml
@@ -0,0 +1,49 @@
+---
+# Get server Moids
+- name: Get server Moid
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ cisco.intersight.intersight_info:
+ <<: *api_info
+ server_names:
+ - "{{ item }}"
+ loop: "{{ hx_servers }}"
+ register: inventory
+# Get Cluster Profile Attributes
+- name: "Get HyperFlex Cluster Profile"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ClusterProfiles
+ query_params:
+ $filter: "Name eq '{{ hx_cluster_name }}'"
+ register: profile
+# Assign servers and profile to node profile
+- name: "Configure Node Profile"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/NodeProfiles
+ query_params:
+ $filter: "Name eq '{{ hx_node_profile_prefix }}-{{ '%02d' % (idx + 1) }}'"
+ api_body: {
+ "Name":"{{ hx_node_profile_prefix }}-{{ '%02d' % (idx + 1) }}",
+ "AssignedServer": {
+ "Moid": "{{ item.intersight_servers[0].Moid }}",
+ "ObjectType": "compute.RackUnit"
+ },
+ "ClusterProfile": {
+ "Moid": "{{ profile.api_response.Moid }}"
+ }
+ }
+ when: item.intersight_servers is not none
+ loop: "{{ inventory.results }}"
+ loop_control:
+ index_var: idx
+ label: "{{ item.intersight_servers[0].Name }}"
+
+- debug: msg="HyperFlex Node Profiles have been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/proxy/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/proxy/tasks/main.yml
new file mode 100644
index 000000000..6023907af
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/proxy/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+- name: "Configure Proxy Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/ProxySettingPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_proxy_setting_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_proxy_setting_policy }}",
+ "Hostname":"{{ hx_proxy_setting_hostname }}",
+ "Port":"{{ hx_proxy_setting_port }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: proxy_setting
+
+- debug: msg="HyperFlex Proxy Policy named {{ hx_proxy_setting_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/software_version/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/software_version/tasks/main.yml
new file mode 100644
index 000000000..878c1bf58
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/software_version/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+- name: "Configure Software Version Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/SoftwareVersionPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_software_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_software_policy }}",
+ "HxdpVersion":"{{ hxdp_version }}",
+ "ServerFirmwareVersion":"{{ ucs_firmware_version }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: software_policy
+
+- debug: msg="HyperFlex Software Version Policy named {{ hx_software_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/sys_config/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/sys_config/tasks/main.yml
new file mode 100644
index 000000000..d5354c11b
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/sys_config/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: "Configure System Config Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/SysConfigPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_sys_config_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name": "{{ hx_sys_config_policy }}",
+ "Timezone":"{{ hx_sys_config_timezone }}",
+ "DnsServers":"{{ hx_sys_config_dns_servers }}",
+ "NtpServers":"{{ hx_sys_config_ntp_servers }}",
+ "DnsDomainName":"{{ hx_sys_config_dns_domain }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: sys_config
+
+- debug: msg="HyperFlex System Config Policy named {{ hx_sys_config_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/vcenter/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/vcenter/tasks/main.yml
new file mode 100644
index 000000000..d7720e13e
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/vcenter/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: "Configure vCenter Config Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ intersight_rest_api:
+ <<: *api_info
+ resource_path: /hyperflex/VcenterConfigPolicies
+ query_params:
+ $filter: "Name eq '{{ hx_vcenter_config_policy }}'"
+ api_body: {
+ "Organization": {
+ "Moid": "{{ intersight_org.api_response.Moid }}"
+ },
+ "Name":"{{ hx_vcenter_config_policy }}",
+ "Hostname":"{{ hx_vcenter_hostname }}",
+ "Username":"{{ hx_vcenter_username }}",
+ "Password":"{{ hx_vcenter_password | default(omit) }}",
+ "DataCenter":"{{ hx_vcenter_datacenter }}",
+ "ClusterProfiles": [
+ {
+ "Moid": "{{ cluster_profile.api_response.Moid }}"
+ }
+ ]
+ }
+ register: vcenter
+
+- debug: msg="HyperFlex vCenter Config Policy named {{ hx_vcenter_config_policy }} has been created successfully."
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml
new file mode 100644
index 000000000..427b45d57
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml
@@ -0,0 +1,40 @@
+---
+- name: "Configure {{ api_body.Name }} Server Policy"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ cisco.intersight.intersight_rest_api:
+ <<: *api_info
+ resource_path: "{{ resource_path }}"
+ query_params:
+ $filter: "Name eq '{{ api_body.Name }}'"
+ api_body: "{{ api_body }}"
+ register: policy_resp
+# Append profile_resp list to policy
+- block:
+ # Create a list of all host's profile Moids
+ - set_fact:
+ # See the Ansible docs on json_query for info on how the Moid data is being extracted
+ profile_list: "{{ ansible_play_hosts | map('extract', hostvars, 'profile_resp') | list | json_query(moid_query) }}"
+ vars:
+ moid_query: "[*].api_response.{Moid: Moid, ObjectType: 'server.Profile'}"
+ - name: "Update Server Profiles used by {{ api_body.Name }} Server Policy (change may always be reported)"
+ cisco.intersight.intersight_rest_api:
+ <<: *api_info
+ resource_path: "{{ resource_path }}"
+ query_params:
+ $filter: "Name eq '{{ api_body.Name }}'"
+ api_body: {
+ "Profiles": "{{ profile_list + policy_resp.api_response.Profiles }}"
+ }
+ # Do not update if the profile isn't available
+ when:
+ - profile_resp is defined
+ - profile_resp.api_response.Moid is defined
+ - policy_resp is defined
+ - policy_resp.api_response.Profiles is defined
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/servers/actions/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/servers/actions/tasks/main.yml
new file mode 100644
index 000000000..0fb1ae9c8
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/roles/servers/actions/tasks/main.yml
@@ -0,0 +1,30 @@
+---
+- name: "Configure {{ inventory_hostname }} power state"
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ cisco.intersight.intersight_rest_api:
+ <<: *api_info
+ resource_path: /compute/ServerSettings
+ query_params:
+ $filter: "Server.Moid eq '{{ server_moid }}'"
+ api_body: {
+ "AdminPowerState": "{{ power_state }}"
+ }
+ when: power_state is defined
+# Configure LED locator state
+- name: "Configure {{ inventory_hostname }} locator state"
+ cisco.intersight.intersight_rest_api:
+ <<: *api_info
+ resource_path: /compute/ServerSettings
+ query_params:
+ $filter: "Server.Moid eq '{{ server_moid }}'"
+ api_body: {
+ "AdminLocatorLedState": "{{ locator_state }}"
+ }
+ when: locator_state is defined