forked from ugo-emekauwa/hx-auto-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HX_Auto_Deploy.py
1677 lines (1531 loc) · 80.9 KB
/
HX_Auto_Deploy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
Cisco HyperFlex Edge Automated Deployment Tool (HX Auto Deploy), v2.0
Author: Ugo Emekauwa
Contact: [email protected], [email protected]
Summary: The Cisco HyperFlex Edge Automated Deployment Tool (HX Auto Deploy)
enables automated deployment of Cisco HyperFlex Edge clusters through
the Cisco Intersight API.
GitHub Repository: https://github.com/ugo-emekauwa/hx-auto-deploy
"""
########################
# MODULE REQUIREMENT 1 #
########################
"""
For the following variable below named key_id, please fill in between
the quotes your Intersight API Key ID.
Here is an example:
key_id = "5c89885075646127773ec143/5c82fc477577712d3088eb2f/5c8987b17577712d302eaaff"
"""
key_id = ""
########################
# MODULE REQUIREMENT 2 #
########################
"""
For the following variable below named key, please fill in between
the quotes your system's file path to your Intersight API key "SecretKey.txt"
file.
Here is an example:
key = "J:\\SecretKey.txt"
"""
key = ""
########################
# MODULE REQUIREMENT 3 #
########################
"""
Provide the required configuration settings for deploying your HyperFlex
cluster. Remove the sample values and replace them with your own, where
applicable.
To identify the servers to be used for the HyperFlex cluster, the desired
cluster size and cluster server node attributes are needed to select the
correct servers registered under your Intersight account.
Under the "HyperFlex Edge Automated Deployment Tool Specific Settings"
configuration section below, for the hx_cluster_size variable, enter the
desired cluster size. For the hx_node_attribute_list variable, provide within
the list either the CIMC/KVM IP address or the serial number of the registered
servers in the desired cluster order. Within the Intersight GUI, in the
'ADMIN/Devices' section of the navigation pane, the CIMC/KVM IP address is
under the column 'Device IP', and the serial number is under the
column 'Device ID'. The amount of entries in the
hx_node_attribute_list variable list must match the provided cluster size
number for the hx_cluster_size variable.
Here are a few examples:
hx_cluster_size = 2
hx_node_attribute_list = ("198.18.135.116", "198.18.135.117")
or
hx_cluster_size = 3
hx_node_attribute_list = ("ABV1304000V", "EZL252770MU", "WIA344370GE")
or
hx_cluster_size = 4
hx_node_attribute_list = ("198.18.135.116", "EZL252770MU", "WIA344370GE", "198.18.135.119")
The remaining variables are requesting the same configuration settings as the
Intersight HyperFlex Cluster Profile Wizard GUI and are listed in the same order.
"""
####### Start Configuration Settings - Provide values for the variables listed below. #######
# HyperFlex Edge Automated Deployment Tool Specific Settings
# NOTE - For the hx_node_attribute_list variable value, provide a list of the CIMC/KVM IP address (Device IP) or the serial number (Device ID) of the registered servers.
hx_cluster_size = 3
hx_node_attribute_list = ["198.18.135.116", "198.18.135.117", "198.18.135.118"]
# HyperFlex Cluster Profile Settings (Under the General step in the GUI Wizard)
hx_cluster_profile_name = "dcloud-hx-edge-cluster-1"
hx_software_version = "4.0(2c)"
hx_cluster_profile_description = f"A HyperFlex Cluster Profile for {hx_cluster_profile_name} generated by the HX Auto Deploy Tool."
hx_policy_name_prefix = hx_cluster_profile_name
# HyperFlex Local Credential Policy Settings (Security section under the Cluster Configuration step in the GUI Wizard)
default_factory_esxi_hypervisor_password_set = True
esxi_hypervisor_admin_username = "root"
esxi_hypervisor_admin_password = "C1sco12345!"
storage_controller_vm_root_user_password = "C1sco12345!"
# HyperFlex System Configuration Policy Settings (DNS, NTP and Timezone section under the Cluster Configuration step in the GUI Wizard)
# NOTE - For the timezone variable value, a full list of supported values can be found on the Intersight GUI or the Olson tz database.'
# NOTE - For the dns_servers_list and ntp_servers_list variables, provided IP address entries should be in IPv4 format.
# NOTE - More than one IPv4 address entry can be added to each list by separating with commas.
timezone = "Etc/GMT"
dns_suffix = "dcloud.cisco.com"
dns_servers_list = ["198.18.133.1"]
ntp_servers_list = ["198.18.128.1"]
# HyperFlex VMware vCenter Configuration Policy Settings (vCenter section under the Cluster Configuration step in the GUI Wizard)
vcenter_fqdn_or_ip = "198.18.133.30"
vcenter_admin_username = "[email protected]"
vcenter_admin_password = "C1sco12345!"
vcenter_hosts_and_clusters_datacenter_name = "dCloud-DC"
# HyperFlex Cluster Storage Configuration Policy Settings (Storage Configuration section under the Cluster Configuration step in the GUI Wizard)
enable_vdi_optimization = False
cleanup_disk_partitions = True
# HyperFlex Node Configuration Policy Settings (IP & Hostname section under the Cluster Configuration step in the GUI Wizard)
# NOTE - Provided IP addresses should be in IPv4 format.
esxi_hostname_prefix = "hx-edge-esxi"
esxi_mgmt_ip_range_start_address = "198.18.135.101"
esxi_mgmt_ip_range_end_address = "198.18.135.103"
esxi_mgmt_ip_range_subnet_mask = "255.255.192.0"
esxi_mgmt_ip_range_gateway = "198.18.128.1"
storage_controller_vm_ip_range_start_address = "198.18.135.104"
storage_controller_vm_ip_range_end_address = "198.18.135.106"
storage_controller_vm_ip_range_subnet_mask = "255.255.192.0"
storage_controller_vm_ip_range_gateway = "198.18.128.1"
# HyperFlex Cluster Network Configuration Policy Settings (Network Configuration section under the Cluster Configuration step in the GUI Wizard)
# NOTE - Supported values for the hx_node_uplink_speed are "1G" or "10G". "10G" supports 10 Gbps and higher.
# NOTE - The physical connectivity of the HX server nodes must also meet the topology requirements for the specified uplink speed.
# NOTE - For the MAC address prefix start and end addresses, leave the default value of "00", unless modification is needed. If so, provide only two digits for the 4th octet.
# NOTE - The first three octets (six digits) or OUI of 00:25:B5 is hard-coded for the MAC prefix start and end addresses.
hx_node_uplink_speed = "1G"
hx_mac_prefix_start_address = "00"
hx_mac_prefix_end_address = "00"
hx_mgmt_vlan_id = 0
enable_hx_node_uplink_jumbo_frames = False
# HyperFlex Storage Network Setting (Under the Cluster Configuration step in the GUI Wizard)
hx_storage_vlan_id = 100
# HyperFlex Cluster Management IP Address and MAC Prefix Address Settings (Under the Nodes Configuration step in the GUI Wizard)
# NOTE - The provided IP address should be in IPv4 format.
# NOTE - For the MAC address prefix, leave the default value of "00", unless modification is needed. If so, provide only two digits for the 4th octet.
# NOTE - The first three octets (six digits) or OUI of 00:25:B5 is hard-coded for the MAC prefix address.
hx_connect_mgmt_ip_address = "198.18.135.100"
hx_mac_prefix_address = "00"
####### Finish Configuration Settings - The required value entries are complete. #######
# Import needed Python modules
import sys
import json
import ipaddress
import requests
import intersight
from intersight.intersight_api_client import IntersightApiClient
# Starting the Automated HyperFlex Edge Install Deployment Tool
print("\nStarting the Cisco HyperFlex Edge Automated Deployment Tool (HX Auto Deploy).\n")
# Establish dictionary for the provided variable values
variable_dictionary = (
{"Name": "key_id",
"Value": key_id,
"Configuration Section": "MODULE REQUIREMENT 1",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "5c89885075646127773ec143/5c82fc477577712d3088eb2f/5c8987b17577712d302eaaff" retrieved under API Keys in Settings of the targeted Intersight account.',
"Max Length": None,
"Required Character": "/",
},
{"Name": "key",
"Value": key,
"Configuration Section": "MODULE REQUIREMENT 2",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "J:\\SecretKey.txt", pointing to the file system location of the "SecretKey.txt" file that belongs to the API key of the targeted Intersight account.',
"Max Length": None,
"Required Character": None,
},
{"Name": "hx_cluster_size",
"Value": hx_cluster_size,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Edge Auto Deploy Tool Specific Settings",
"Expected Type": int,
"Supplemental Type": None,
"Restricted Value": (2, 3, 4),
"Example Value": 'an integer of 2, 3, or 4, which are the currently supported HyperFlex Edge cluster sizes.',
"Max Length": None,
"Required Character": None,
},
{"Name": "hx_node_attribute_list",
"Value": hx_node_attribute_list,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Edge Auto Deploy Tool Specific Settings",
"Expected Type": list,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a list such as ("198.18.135.116", "198.18.135.117", "198.18.135.118").',
"Max Length": hx_cluster_size,
"Required Character": None,
},
{"Name": "hx_cluster_profile_name",
"Value": hx_cluster_profile_name,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Profile Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "dcloud-hx-edge-cluster-1".',
"Max Length": None,
"Required Character": None,
},
{"Name": "hx_software_version",
"Value": hx_software_version,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Profile Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "4.0(2c)".',
"Max Length": None,
"Required Character": None,
},
{"Name": "hx_cluster_profile_description",
"Value": hx_cluster_profile_description,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Profile Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "A HyperFlex Cluster Profile for dcloud-hx-edge-cluster-1 generated by the HX Auto Deploy Tool.".',
"Max Length": None,
"Required Character": None,
},
{"Name": "hx_policy_name_prefix",
"Value": hx_policy_name_prefix,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Profile Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "hx_cluster_profile_name".',
"Max Length": None,
"Required Character": None,
},
{"Name": "default_factory_esxi_hypervisor_password_set",
"Value": default_factory_esxi_hypervisor_password_set,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Local Credential Policy Settings",
"Expected Type": bool,
"Supplemental Type": None,
"Restricted Value": (True, False),
"Example Value": 'a Boolean of True or False.',
"Max Length": None,
"Required Character": None,
},
{"Name": "esxi_hypervisor_admin_username",
"Value": esxi_hypervisor_admin_username,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Local Credential Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "root".',
"Max Length": None,
"Required Character": None,
},
{"Name": "esxi_hypervisor_admin_password",
"Value": esxi_hypervisor_admin_password,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Local Credential Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "C1sco12345!".',
"Max Length": None,
"Required Character": None,
},
{"Name": "storage_controller_vm_root_user_password",
"Value": storage_controller_vm_root_user_password,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Local Credential Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "C1sco12345!".',
"Max Length": None,
"Required Character": None,
},
{"Name": "timezone",
"Value": timezone,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex System Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "Etc/GMT" or "America/New_York". A full list of supported values can be found on the Intersight GUI or the Olson tz database.',
"Max Length": None,
"Required Character": "/",
},
{"Name": "dns_suffix",
"Value": dns_suffix,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex System Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "dcloud.cisco.com".',
"Max Length": None,
"Required Character": None,
},
{"Name": "dns_servers_list",
"Value": dns_servers_list,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex System Configuration Policy Settings",
"Expected Type": list,
"Supplemental Type": "ip_list",
"Restricted Value": None,
"Example Value": 'a list such as ["198.18.133.1"].',
"Max Length": None,
"Required Character": None,
},
{"Name": "ntp_servers_list",
"Value": ntp_servers_list,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex System Configuration Policy Settings",
"Expected Type": list,
"Supplemental Type": "ip_list",
"Restricted Value": None,
"Example Value": 'a list such as ["198.18.128.1"].',
"Max Length": None,
"Required Character": None,
},
{"Name": "vcenter_fqdn_or_ip",
"Value": vcenter_fqdn_or_ip,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex VMware vCenter Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "198.18.133.30".',
"Max Length": 15,
"Required Character": None,
},
{"Name": "vcenter_admin_username",
"Value": vcenter_admin_username,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex VMware vCenter Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "[email protected]".',
"Max Length": None,
"Required Character": None,
},
{"Name": "vcenter_admin_password",
"Value": vcenter_admin_password,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex VMware vCenter Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "C1sco12345!".',
"Max Length": None,
"Required Character": None,
},
{"Name": "vcenter_hosts_and_clusters_datacenter_name",
"Value": vcenter_hosts_and_clusters_datacenter_name,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex VMware vCenter Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "dCloud-DC".',
"Max Length": None,
"Required Character": None,
},
{"Name": "enable_vdi_optimization",
"Value": enable_vdi_optimization,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Storage Configuration Policy Settings",
"Expected Type": bool,
"Supplemental Type": None,
"Restricted Value": (True, False),
"Example Value": 'a Boolean of True or False.',
"Max Length": None,
"Required Character": None,
},
{"Name": "cleanup_disk_partitions",
"Value": cleanup_disk_partitions,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Storage Configuration Policy Settings",
"Expected Type": bool,
"Supplemental Type": None,
"Restricted Value": (True, False),
"Example Value": 'a Boolean of True or False.',
"Max Length": None,
"Required Character": None,
},
{"Name": "esxi_hostname_prefix",
"Value": esxi_hostname_prefix,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "hx-edge-esxi". The string value can be no longer than 60 characters.',
"Max Length": 60,
"Required Character": None,
},
{"Name": "esxi_mgmt_ip_range_start_address",
"Value": esxi_mgmt_ip_range_start_address,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "198.18.135.101".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "esxi_mgmt_ip_range_end_address",
"Value": esxi_mgmt_ip_range_end_address,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "198.18.135.103".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "esxi_mgmt_ip_range_subnet_mask",
"Value": esxi_mgmt_ip_range_subnet_mask,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "255.255.192.0".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "esxi_mgmt_ip_range_gateway",
"Value": esxi_mgmt_ip_range_gateway,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "198.18.128.1".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "storage_controller_vm_ip_range_start_address",
"Value": storage_controller_vm_ip_range_start_address,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "198.18.135.104".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "storage_controller_vm_ip_range_end_address",
"Value": storage_controller_vm_ip_range_end_address,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "198.18.135.106".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "storage_controller_vm_ip_range_subnet_mask",
"Value": storage_controller_vm_ip_range_subnet_mask,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "255.255.192.0".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "storage_controller_vm_ip_range_gateway",
"Value": storage_controller_vm_ip_range_gateway,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Node Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "198.18.128.1".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "hx_node_uplink_speed",
"Value": hx_node_uplink_speed,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Network Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": ("1G", "10G"),
"Example Value": 'either the string "1G" or "10G" only. The option "10G" will also support and enable higher speeds.',
"Max Length": 3,
"Required Character": None,
},
{"Name": "hx_mac_prefix_start_address",
"Value": hx_mac_prefix_start_address,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Network Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "00". This value is only used with 10G+ uplink speeds. The MAC Address OUI (Organizationally Unique Identifier) of 00:25:B5 is hard-coded.',
"Max Length": 2,
"Required Character": None,
},
{"Name": "hx_mac_prefix_end_address",
"Value": hx_mac_prefix_end_address,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Network Configuration Policy Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "00". This value is only used with 10G+ uplink speeds. The MAC Address OUI (Organizationally Unique Identifier) of 00:25:B5 is hard-coded.',
"Max Length": 2,
"Required Character": None,
},
{"Name": "hx_mgmt_vlan_id",
"Value": hx_mgmt_vlan_id,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Network Configuration Policy Settings",
"Expected Type": int,
"Supplemental Type": None,
"Restricted Value": range(0,4096),
"Example Value": 'an integer from 0 - 4095',
"Max Length": None,
"Required Character": None,
},
{"Name": "enable_hx_node_uplink_jumbo_frames",
"Value": enable_hx_node_uplink_jumbo_frames,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Network Configuration Policy Settings",
"Expected Type": bool,
"Supplemental Type": None,
"Restricted Value": (True, False),
"Example Value": 'a Boolean of True or False.',
"Max Length": None,
"Required Character": None,
},
{"Name": "hx_storage_vlan_id",
"Value": hx_storage_vlan_id,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Storage Network Setting",
"Expected Type": int,
"Supplemental Type": None,
"Restricted Value": range(1,4096),
"Example Value": 'an integer from 1 - 4095',
"Max Length": None,
"Required Character": None,
},
{"Name": "hx_connect_mgmt_ip_address",
"Value": hx_connect_mgmt_ip_address,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Management IP Address and MAC Prefix Address Settings",
"Expected Type": str,
"Supplemental Type": "ip_string",
"Restricted Value": None,
"Example Value": 'a string such as "198.18.135.100".',
"Max Length": 15,
"Required Character": ".",
},
{"Name": "hx_mac_prefix_address",
"Value": hx_mac_prefix_address,
"Configuration Section": "MODULE REQUIREMENT 3 --> HyperFlex Cluster Management IP Address and MAC Prefix Address Settings",
"Expected Type": str,
"Supplemental Type": None,
"Restricted Value": None,
"Example Value": 'a string such as "00". This value is only used with 10G+ uplink speeds. The MAC Address OUI (Organizationally Unique Identifier) of 00:25:B5 is hard-coded.',
"Max Length": 2,
"Required Character": None,
},
)
# Begin performing a preliminary check of the provided variable values
print("Performing a preliminary check of the provided variable values...\n")
for variable in variable_dictionary:
# Verify the provided variable value matches the expected type (e.g. string, integer, list, Boolean, etc.)
if type(variable["Value"]) != variable["Expected Type"]:
print(f'The value provided for the {variable["Name"]} variable is not in '
'the correct format.\n'
f'Please provide a value in the {variable["Expected Type"]} format '
'and restart the HX Auto Deploy Tool.\n'
f'The {variable["Name"]} variable can be found under '
f'{variable["Configuration Section"]}.\n'
f'An example value would be {variable["Example Value"]}\n')
sys.exit(0)
# Verify the provided variable value contains any required characters
if variable["Required Character"]:
if variable["Required Character"] not in variable["Value"]:
print(f'The value provided for the {variable["Name"]} variable is '
f'missing the required character "{variable["Required Character"]}" '
'in the value.\n'
'Please update the value and restart the HX Auto Deploy Tool.\n'
f'The {variable["Name"]} variable can be found under '
f'{variable["Configuration Section"]}.\n'
f'An example value would be {variable["Example Value"]}\n')
sys.exit(0)
# Verify the provided variable values for single IP address strings are valid IP addresses
if variable["Supplemental Type"] == "ip_string":
try:
ipaddress.ip_address(variable["Value"])
except Exception:
print(f'The value provided for the {variable["Name"]} variable is a not '
'a correctly formatted IPv4 address.\n'
'Please update the value and restart the HX Auto Deploy Tool.\n'
f'The {variable["Name"]} variable can be found under '
f'{variable["Configuration Section"]}.\n'
f'An example value would be {variable["Example Value"]}\n')
sys.exit(0)
# Verify the provided variable values for lists of IP address strings contain valid IP addresses
if variable["Supplemental Type"] == "ip_list":
try:
for variable_ip in variable["Value"]:
ipaddress.ip_address(variable_ip)
except Exception:
print(f'The value provided for the {variable["Name"]} variable contains '
'an entry that is not a correctly formatted IPv4 address.\n'
'Please update the value and restart the HX Auto Deploy Tool.\n'
f'The {variable["Name"]} variable can be found under '
f'{variable["Configuration Section"]}.\n'
f'An example value would be {variable["Example Value"]}\n')
sys.exit(0)
# Verify the provided variable value matches any restricted values
if variable["Restricted Value"]:
if variable["Value"] not in variable["Restricted Value"]:
print(f'The value provided for the {variable["Name"]} variable is not an '
'accepted value.\n'
'Please update the value and restart the HX Auto Deploy Tool.\n'
f'The {variable["Name"]} variable can be found under '
f'{variable["Configuration Section"]}.\n'
f'An example value would be {variable["Example Value"]}\n')
sys.exit(0)
# Verify the provided variable value does not exceed any set maximum length
if variable["Max Length"]:
if len(variable["Value"]) > variable["Max Length"]:
print(f'The value provided for the {variable["Name"]} variable exceeds the '
'maximum accepted length.\n'
'Please update the value and restart the HX Auto Deploy Tool.\n'
f'The {variable["Name"]} variable can be found under '
f'{variable["Configuration Section"]}.\n'
f'An example value would be {variable["Example Value"]}\n')
sys.exit(0)
# Verify the provided variable value for lists are not empty
if variable["Expected Type"] == list:
if not variable["Value"]:
print(f'The value provided for the {variable["Name"]} variable is an '
'empty list.\n'
'Please update the value and restart the HX Auto Deploy Tool.\n'
f'The {variable["Name"]} variable can be found under '
f'{variable["Configuration Section"]}.\n'
f'An example value would be {variable["Example Value"]}\n')
sys.exit(0)
# Verify the provided HyperFlex node attribute list can support the provided HyperFlex cluster size
if len(hx_node_attribute_list) < hx_cluster_size:
print("The provided HyperFlex node attribute list has a total of "
f"{len(hx_node_attribute_list)} entries. This is less than the provided "
f"HyperFlex cluster size of {hx_cluster_size}. Please increase the "
"provided HyperFlex node attributes then restart "
"the HX Auto Deploy Tool.\n")
sys.exit(0)
# Establish function to create IP address range lists
def create_ip_list(starting_ip_address,ending_ip_address):
"""This is a function to create a list range of IP addresses based on the
provided starting IP address and ending IP address.
"""
format_starting_ip_address = ipaddress.ip_address(starting_ip_address)
format_ending_ip_address = ipaddress.ip_address(ending_ip_address)
ip_range_staging_list = list(range(int(format_starting_ip_address), int(format_ending_ip_address + 1)))
ip_range_production_list = []
for ip in ip_range_staging_list:
converted_ip = ipaddress.ip_address(ip)
ip_range_production_list.append(converted_ip.compressed)
return ip_range_production_list
# Verify the VMware ESXi hypervisor management starting and ending IP addresses do not conflict
if esxi_mgmt_ip_range_start_address == esxi_mgmt_ip_range_end_address:
print("For the VMware ESXi hypervisor management IP range, the provided "
f"ending IP address of {esxi_mgmt_ip_range_end_address} is the same as "
"the provided starting IP address of "
f"{esxi_mgmt_ip_range_start_address}. Please provide a different ending "
"IP address and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the VMware ESXi hypervisor management starting IP address and subnet mask can be configured on an IP interface
try:
esxi_mgmt_ip_range_start_address_ip_interface = ipaddress.ip_interface(f"{esxi_mgmt_ip_range_start_address}/{esxi_mgmt_ip_range_subnet_mask}")
except Exception as exception_message:
print("There was an issue with testing the IP interface configuration for "
"the provided VMware ESXi hypervisor management starting IP address of "
f"{esxi_mgmt_ip_range_start_address} and the associated subnet mask of "
f"{esxi_mgmt_ip_range_subnet_mask}.\n"
"Please review the error message below, repair the provided IP address "
"settings, then re-run the HX Auto Deploy Tool.\n")
print(exception_message)
sys.exit(0)
# Determine VMware ESXi hypervisor management IP network from provided starting IP address and subnet mask
esxi_mgmt_ip_range_start_address_network = esxi_mgmt_ip_range_start_address_ip_interface.network
# Verify the VMware ESXi hypervisor management ending IP address is in the same network as the starting IP address
if ipaddress.ip_address(esxi_mgmt_ip_range_end_address) not in esxi_mgmt_ip_range_start_address_network:
print("For the VMware ESXi hypervisor management IP range, the provided "
f"ending IP address of {esxi_mgmt_ip_range_end_address} is not in the "
"same subnet as the provided starting IP address of "
f"{esxi_mgmt_ip_range_start_address}. Please provide a different ending "
"IP address and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the VMware ESXi hypervisor management gateway IP address is in the same network as the starting IP address
if ipaddress.ip_address(esxi_mgmt_ip_range_gateway) not in esxi_mgmt_ip_range_start_address_network:
print("For the VMware ESXi hypervisor management IP range, the provided "
f"gateway IP address of {esxi_mgmt_ip_range_gateway} is not in the "
"same subnet as the provided starting IP address of "
f"{esxi_mgmt_ip_range_start_address}. Please provide a different "
"gateway IP address and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Create the VMware ESXi hypervisor management IP address range list
esxi_mgmt_ip_range_list = create_ip_list(esxi_mgmt_ip_range_start_address, esxi_mgmt_ip_range_end_address)
# Verify the created VMware ESXi hypervisor management IP address range list can support the provided HyperFlex cluster size
if len(esxi_mgmt_ip_range_list) < hx_cluster_size:
print("The VMware ESXi hypervisor management IP address range has a total "
f"of {len(esxi_mgmt_ip_range_list)} usable addresses. This is less than "
f"the provided HyperFlex cluster size of {hx_cluster_size}. Please "
"increase the size of the VMware ESXi hypervisor management IP address "
"range then restart the HX Auto Deploy Tool. The provided value for "
"the starting or ending IP and subnet mask may need to be adjusted.\n"
f"Current starting IP address: {esxi_mgmt_ip_range_start_address}\n"
f"Current ending IP address: {esxi_mgmt_ip_range_end_address}\n"
f"Current subnet mask: {esxi_mgmt_ip_range_subnet_mask}\n")
sys.exit(0)
# Verify the created VMware ESXi hypervisor management IP address range list does not conflict with any entries in the HX node attribute list
for esxi_mgmt_ip in esxi_mgmt_ip_range_list:
if esxi_mgmt_ip in hx_node_attribute_list:
print(f"The ESXi hypervisor management IP address of {esxi_mgmt_ip} "
"created from the IP address range "
f"{esxi_mgmt_ip_range_start_address} - {esxi_mgmt_ip_range_end_address}, "
"conflicts with an IP address entry in the HX node attribute list "
"variable named hx_node_attribute_list.\n"
"The hx_node_attribute_list variable contains the following entries: \n"
f"{hx_node_attribute_list}\n"
"Please resolve the IP address conflict and restart "
"the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HXDP storage controller VM management starting IP address does not conflict with any entries in the VMware ESXi hypervisor management IP address range list
if storage_controller_vm_ip_range_start_address in esxi_mgmt_ip_range_list:
print("For the HXDP storage controller VM management IP range, the provided "
f"starting IP address of {storage_controller_vm_ip_range_start_address} "
"is in the same range of IP addresses allocated for the VMware ESXi "
"hypervisor management interfaces. Please provide a different starting "
"IP address and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HXDP storage controller VM management ending IP address does not conflict with any entries in the VMware ESXi hypervisor management IP address range list
if storage_controller_vm_ip_range_end_address in esxi_mgmt_ip_range_list:
print("For the HXDP storage controller VM management IP range, the provided "
f"ending IP address of {storage_controller_vm_ip_range_end_address} is "
"in the same range of IP addresses allocated for the VMware ESXi "
"hypervisor management interfaces. Please provide a different ending "
"IP address and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HXDP storage controller VM management starting and ending IP addresses do not conflict
if storage_controller_vm_ip_range_start_address == storage_controller_vm_ip_range_end_address:
print("For the HXDP storage controller VM management IP range, the provided "
f"ending IP address of {storage_controller_vm_ip_range_end_address} is "
"the same as the provided starting IP address of "
f"{storage_controller_vm_ip_range_start_address}. Please provide a "
"different ending IP address and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HXDP storage controller VM management starting IP address and subnet mask can be configured on an IP interface
try:
storage_controller_vm_ip_range_start_address_ip_interface = ipaddress.ip_interface(f"{storage_controller_vm_ip_range_start_address}/{storage_controller_vm_ip_range_subnet_mask}")
except Exception as exception_message:
print("There was an issue with testing the IP interface configuration for "
"the provided HXDP storage controller VM management starting IP "
f"address of {storage_controller_vm_ip_range_start_address} "
"and the associated subnet mask of "
f"{storage_controller_vm_ip_range_subnet_mask}.\n"
"Please review the error message below, repair the provided IP address "
"settings, then re-run the HX Auto Deploy Tool.\n")
print(exception_message)
sys.exit(0)
# Determine HXDP storage controller VM management IP network from provided starting IP address and subnet mask
storage_controller_vm_ip_range_start_address_network = storage_controller_vm_ip_range_start_address_ip_interface.network
# Verify the HXDP storage controller VM management ending IP address is in the same network as the starting IP address
if ipaddress.ip_address(storage_controller_vm_ip_range_end_address) not in storage_controller_vm_ip_range_start_address_network:
print("For the HXDP storage controller VM management IP range, the provided "
f"ending IP address of {storage_controller_vm_ip_range_end_address} is "
"not in the same subnet of the provided starting IP address of "
f"{storage_controller_vm_ip_range_start_address}. Please provide a "
"different ending IP address and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HXDP storage controller VM management gateway IP address is in the same network as the starting IP address
if ipaddress.ip_address(storage_controller_vm_ip_range_gateway) not in storage_controller_vm_ip_range_start_address_network:
print("For the HXDP storage controller VM management IP range, the provided "
f"gateway IP address of {storage_controller_vm_ip_range_gateway} is "
"not in the same subnet of the provided starting IP address of "
f"{storage_controller_vm_ip_range_start_address}. Please provide a "
"different gateway IP address and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Create the HXDP storage controller VM IP address range list
storage_controller_vm_ip_range_list = create_ip_list(storage_controller_vm_ip_range_start_address, storage_controller_vm_ip_range_end_address)
# Verify the created HXDP storage controller VM IP address range list can support the provided HyperFlex cluster size
if len(storage_controller_vm_ip_range_list) < hx_cluster_size:
print("The HXDP storage controller VM IP address range has a total of "
f"{len(storage_controller_vm_ip_range_list)} usable addresses. This is "
f"less than the provided HyperFlex cluster size of {hx_cluster_size}. "
"Please increase the size of the HXDP storage controller VM IP address "
"range then restart the HX Auto Deploy Tool. The provided value for "
"the starting or ending IP and subnet mask may need to be adjusted.\n"
f"Current starting IP address: {storage_controller_vm_ip_range_start_address}\n"
f"Current ending IP address: {storage_controller_vm_ip_range_end_address}\n"
f"Current subnet mask: {storage_controller_vm_ip_range_subnet_mask}\n")
sys.exit(0)
# Verify the created HXDP storage controller VM IP address range list does not conflict with any entries in the HX node attribute list
for storage_controller_vm_ip in storage_controller_vm_ip_range_list:
if storage_controller_vm_ip in hx_node_attribute_list:
print(f"The HXDP storage controller VM IP address of {storage_controller_vm_ip} "
"created from the IP address range of "
f"{storage_controller_vm_ip_range_start_address} - "
f"{storage_controller_vm_ip_range_end_address}, conflicts with an "
"IP address entry in the HX node attribute list variable named "
"hx_node_attribute_list.\n"
"The hx_node_attribute_list variable contains the following entries: \n"
f"{hx_node_attribute_list}\n"
"Please resolve the IP address conflict and restart "
"the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HXDP cluster management (HX Connect) IP address does not conflict with any entries in the VMware ESXi hypervisor management IP address range list
if hx_connect_mgmt_ip_address in esxi_mgmt_ip_range_list:
print("The provided HyperFlex cluster management IP address of "
f"{hx_connect_mgmt_ip_address} is in the same range of IP addresses "
"allocated for the VMware ESXi hypervisor management interfaces. "
"Please provide a different HyperFlex cluster management IP address "
"and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HXDP cluster management (HX Connect) IP address does not conflict with any entries in the HXDP storage controller VM management IP address range list
if hx_connect_mgmt_ip_address in storage_controller_vm_ip_range_list:
print("The provided HyperFlex cluster management IP address of "
f"{hx_connect_mgmt_ip_address} is in the same range of IP addresses "
"allocated for the HXDP storage controller VM management interfaces. "
"Please provide a different HyperFlex cluster management IP address "
"and restart the HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HXDP cluster management (HX Connect) IP address is in the same network as the HXDP storage controller VM IP addresses
if ipaddress.ip_address(hx_connect_mgmt_ip_address) not in storage_controller_vm_ip_range_start_address_network:
print("The provided HyperFlex cluster management IP address of "
f"{hx_connect_mgmt_ip_address} is not in the same subnet of "
f"{storage_controller_vm_ip_range_start_address_network} as the "
"provided starting IP address of "
f"{storage_controller_vm_ip_range_start_address} and the provided "
f"ending IP address of {storage_controller_vm_ip_range_end_address} for "
"the HXDP storage controller VM management interfaces. Please provide "
"a different HyperFlex cluster management IP address and restart the "
"HX Auto Deploy Tool.\n")
sys.exit(0)
# Verify the HyperFlex cluster management IP address does not conflict with any entries in the HX node attribute list
if hx_connect_mgmt_ip_address in hx_node_attribute_list:
print("The HyperFlex cluster management IP address of "
f"{hx_connect_mgmt_ip_address} conflicts with an IP address entry in "
"the HX node attribute list variable named hx_node_attribute_list.\n"
"The hx_node_attribute_list variable contains the following entries: \n"
f"{hx_node_attribute_list}\n"
"Please resolve the IP address conflict and restart "
"the HX Auto Deploy Tool.\n")
sys.exit(0)
# Completion of the preliminary check of the provided variable values
print("The preliminary check of the provided variable values is complete.\n")
# Set the HyperFlex Management Deployment Type
hx_mgmt_platform_type = "EDGE"
# Set the HyperFlex MAC prefix starting and ending addresses based on the provided uplink speed
if hx_node_uplink_speed == "1G":
hx_mac_prefix_start_address_post_uplink_speed_checked = ""
hx_mac_prefix_end_address_post_uplink_speed_checked = ""
else:
hx_mac_prefix_start_address_post_uplink_speed_checked = f"00:25:B5:{hx_mac_prefix_start_address}"
hx_mac_prefix_end_address_post_uplink_speed_checked = f"00:25:B5:{hx_mac_prefix_end_address}"
# Set the HyperFlex MAC prefix address based on the provided uplink speed setting
if hx_node_uplink_speed == "1G":
hx_mac_prefix_address_post_uplink_speed_checked = ""
else:
hx_mac_prefix_address_post_uplink_speed_checked = f"00:25:B5:{hx_mac_prefix_address}"
# Define Intersight SDK IntersightApiClient variables
# Tested on Cisco Intersight API Reference v1.0.9-2110
base_url = "https://intersight.com/api/v1"
api_instance = IntersightApiClient(host=base_url,private_key=key,api_key_id=key_id)
# Establish function to test for the availability of the Intersight API and Intersight account
def test_intersight_service():
"""This is a function to test the availability of the Intersight API and
Intersight account. The Intersight account tested for is the owner of the
provided Intersight API key and key ID.
"""
try:
# Check that Intersight Account is accessible
print("Testing access to the Intersight API by verifying the Intersight "
"account information...")
check_account = intersight.IamAccountApi(api_instance)
get_account = check_account.iam_accounts_get()
if check_account.api_client.last_response.status is not 200:
print("The Intersight API and Account Availability Test did not pass.")
print("The Intersight account information could not be verified.")
print("Exiting due to the Intersight account being unavailable.\n")
print("Please verify that the correct API Key ID has been provided then "
"restart the HX Auto Deploy Tool.\n")
print("If applicable, also verify that all Intersight services are up \n"
"and operational at https://status.intersight.com.\n")
sys.exit(0)
else:
account_name = get_account.results[0].name
print("The Intersight API and Account Availability Test has passed.\n")
print(f"The Intersight account named '{account_name}' has been found.\n")
return account_name
except Exception:
print("Unable to access the Intersight API.")
print("Exiting due to the Intersight API being unavailable.\n")
print("Please verify that the correct API Key ID has been provided then "
"restart the HX Auto Deploy Tool.\n")
print("If applicable, also verify that all Intersight services are up \n"
"and operational at https://status.intersight.com.\n")
sys.exit(0)
# Run the Intersight API and Account Availability Test
print("Running the Intersight API and Account Availability Test.")
intersight_api_test = test_intersight_service()
intersight_account_name = intersight_api_test
# Create the HyperFlex Local Credential Policy for the Cluster Configuration "Security" policy type settings
print("Configuring the HyperFlex Local Credential Policy named "
f"{hx_policy_name_prefix}-local-credential-policy...")
hx_local_credential_policy_body = {
"Name": f"{hx_policy_name_prefix}-local-credential-policy",
"Description": "A HyperFlex Local Credential Policy generated by the HX Auto Deploy Tool.",
"FactoryHypervisorPassword": default_factory_esxi_hypervisor_password_set,
"HypervisorAdmin": esxi_hypervisor_admin_username,
"HypervisorAdminPwd": esxi_hypervisor_admin_password,
"HxdpRootPwd": storage_controller_vm_root_user_password
}
try:
hx_local_credential_policy = intersight.HyperflexLocalCredentialPolicyApi(api_instance)
post_hx_local_credential_policy = hx_local_credential_policy.hyperflex_local_credential_policies_post(hx_local_credential_policy_body)
print("The HyperFlex Local Credential Policy has been configured.\n")
except Exception as exception_message:
print("There was an issue configuring the HyperFlex Local Credential Policy.")
print("Please review and resolve any error messages then restart "
"the HX Auto Deploy Tool.\n")
print(exception_message)
sys.exit(0)
# Create the HyperFlex System Configuration Policy for the Cluster Configuration "DNS, NTP, and Timezone" policy type settings
print("Configuring the HyperFlex System Configuration Policy named "
f"{hx_policy_name_prefix}-sys-config-policy...")
hx_system_configuration_policy_body = {
"Name": f"{hx_policy_name_prefix}-sys-config-policy",
"Description": "A HyperFlex System Configuration Policy generated by the HX Auto Deploy Tool.",
"DnsDomainName": dns_suffix,
"DnsServers": dns_servers_list,
"NtpServers": ntp_servers_list,
"Timezone": timezone
}
try:
hx_system_configuration_policy = intersight.HyperflexSysConfigPolicyApi(api_instance)
post_hx_system_configuration_policy = hx_system_configuration_policy.hyperflex_sys_config_policies_post(hx_system_configuration_policy_body)
print("The HyperFlex System Configuration Policy has been configured.\n")
except Exception as exception_message:
print("There was an issue configuring the .")
print("Please review and resolve any error messages then restart "
"the HX Auto Deploy Tool.\n")
print(exception_message)
sys.exit(0)
# Create the HyperFlex VMware vCenter Configuration Policy for the Cluster Configuration "vCenter (Optional)" policy type settings
print("Configuring the HyperFlex VMware vCenter Configuration Policy named "
f"{hx_policy_name_prefix}-vcenter-config-policy...")
hx_vcenter_configuration_policy_body = {