diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
commit | a453ac31f3428614cceb99027f8efbdb9258a40b (patch) | |
tree | f61f87408f32a8511cbd91799f9cececb53e0374 /collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles | |
parent | Initial commit. (diff) | |
download | ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.tar.xz ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.zip |
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles')
23 files changed, 698 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/.DS_Store b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/.DS_Store Binary files differnew file mode 100644 index 00000000..be0f2115 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/.DS_Store diff --git a/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/auto_support/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/auto_support/tasks/main.yml new file mode 100644 index 00000000..c745cfec --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/auto_support/tasks/main.yml @@ -0,0 +1,28 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_network/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_network/tasks/main.yml new file mode 100644 index 00000000..63efa1f5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_network/tasks/main.yml @@ -0,0 +1,47 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/defaults/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/defaults/main.yml new file mode 100644 index 00000000..a7a0ca66 --- /dev/null +++ b/collections-debian-merged/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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/tasks/main.yml new file mode 100644 index 00000000..f27baf43 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_profile/tasks/main.yml @@ -0,0 +1,30 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_storage/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/cluster_storage/tasks/main.yml new file mode 100644 index 00000000..fdfcf5b8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/deploy/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/deploy/tasks/main.yml new file mode 100644 index 00000000..13b598b6 --- /dev/null +++ b/collections-debian-merged/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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_network/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_network/tasks/main.yml new file mode 100644 index 00000000..616e18ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_network/tasks/main.yml @@ -0,0 +1,35 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/defaults/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/defaults/main.yml new file mode 100644 index 00000000..7ace5ad5 --- /dev/null +++ b/collections-debian-merged/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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/tasks/main.yml new file mode 100644 index 00000000..3238507c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_profile/tasks/main.yml @@ -0,0 +1,28 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_storage/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_storage/tasks/main.yml new file mode 100644 index 00000000..2c95b576 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_cluster_storage/tasks/main.yml @@ -0,0 +1,28 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_software_version/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_software_version/tasks/main.yml new file mode 100644 index 00000000..28ef27e8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/edge_software_version/tasks/main.yml @@ -0,0 +1,27 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/fc/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/fc/tasks/main.yml new file mode 100644 index 00000000..459cc6dc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/fc/tasks/main.yml @@ -0,0 +1,49 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/iscsi/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/iscsi/tasks/main.yml new file mode 100644 index 00000000..bd11cbe2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/iscsi/tasks/main.yml @@ -0,0 +1,35 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/local_credential/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/local_credential/tasks/main.yml new file mode 100644 index 00000000..781bf621 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/local_credential/tasks/main.yml @@ -0,0 +1,30 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_config/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_config/tasks/main.yml new file mode 100644 index 00000000..658a4fb6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_config/tasks/main.yml @@ -0,0 +1,39 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_profiles/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_profiles/tasks/main.yml new file mode 100644 index 00000000..f1a41c47 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/node_profiles/tasks/main.yml @@ -0,0 +1,48 @@ +--- +# 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 }}" + }, + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/proxy/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/proxy/tasks/main.yml new file mode 100644 index 00000000..292c9753 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/proxy/tasks/main.yml @@ -0,0 +1,28 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/software_version/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/software_version/tasks/main.yml new file mode 100644 index 00000000..a80243ba --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/software_version/tasks/main.yml @@ -0,0 +1,28 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/sys_config/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/sys_config/tasks/main.yml new file mode 100644 index 00000000..9cf75443 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/sys_config/tasks/main.yml @@ -0,0 +1,30 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/vcenter/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/vcenter/tasks/main.yml new file mode 100644 index 00000000..4e1a351f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/hyperflex_policies/vcenter/tasks/main.yml @@ -0,0 +1,30 @@ +--- +- 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: { + "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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml new file mode 100644 index 00000000..427b45d5 --- /dev/null +++ b/collections-debian-merged/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/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/servers/actions/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/roles/servers/actions/tasks/main.yml new file mode 100644 index 00000000..0fb1ae9c --- /dev/null +++ b/collections-debian-merged/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 |