summaryrefslogtreecommitdiffstats
path: root/collections-debian-merged/ansible_collections/cisco/intersight/playbooks/hyperflex_cluster_profiles.yml
blob: 90305540f991e17762cb359deb50392b43e7454d (plain)
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
---
#
# Configure HyperFlex Cluster Profiles
#
# The hosts group used is provided by the group variable or defaulted to 'Intersight_HX'.
# You can specify a specific host (or host group) on the command line:
#   ansible-playbook ... -e group=<your host group>
#   e.g., ansible-playbook server_profiles.yml -e group=TME_Demo
#
- hosts: "{{ group | default('Intersight_HX') }}"
  connection: local
  gather_facts: false
  vars:
  # If your inventory or host/group_vars don't specify required api key information, you can set directly below:
  # api_private_key: ~/Downloads/SecretKey.txt
  # api_key_id: 5a3404ac3768393836093cab/5b02fa7e6d6c356772394170/5b02fad36d6c356772394449
  vars_prompt:
    
    - name: "hx_vcenter_password"
      prompt: "Enter the vCenter administrative password"
      private: yes
      confirm: yes
      unsafe: yes

    - name: "hx_hypervisor_password"
      prompt: "Enter the new ESXi nodes' administrative password"
      private: yes
      confirm: yes
      unsafe: yes

    - name: "hx_dp_root_password"
      prompt: "Enter the HyperFlex administrative password"
      private: yes
      confirm: yes
      unsafe: yes

    - name: "execute_auto_support"
      prompt: "Do you need to enable Auto Support settings? (yes/no)"
      private: no

    - name: "execute_proxy"
      prompt: "Do you need to configure proxy settings? (yes/no)"
      private: no

    - name: "execute_iscsi"
      prompt: "Do you need to configure additional vNICs for iSCSI settings? (yes/no)"
      private: no

    - name: "execute_fc"
      prompt: "Do you need to configure additional vHBAs for FC settings? (yes/no)"
      private: no

  tasks:
    # Cluster Profile
    - import_role:
        name: policies/hyperflex_policies/cluster_profile
      vars:
        hx_cluster_profile: "{{ hx_cluster_name }}"
      tags: ['cluster_profile']
    # Software Version 
    - import_role:
        name: policies/hyperflex_policies/software_version
      vars:
        hx_software_policy: "{{ hx_cluster_name }}-software-version-policy"
      tags: ['software']
    # DNS
    - import_role:
        name: policies/hyperflex_policies/sys_config
      vars:
        hx_sys_config_policy: "{{ hx_cluster_name }}-sys-config-policy"
      tags: ['dns']
    # Security
    - import_role:
        name: policies/hyperflex_policies/local_credential
      vars:
        hx_local_credential_policy: "{{ hx_cluster_name }}-local-credential-policy"
      tags: ['security']
    # vCenter
    - import_role:
        name: policies/hyperflex_policies/vcenter
      vars:
        hx_vcenter_config_policy: "{{ hx_cluster_name }}-vcenter-config-policy"
      tags: ['vcenter']
    # Storage Config
    - import_role:
        name: policies/hyperflex_policies/cluster_storage
      vars:
        hx_cluster_storage_policy: "{{ hx_cluster_name }}-cluster-storage-policy"
      tags: ['storage']
    # Auto Support
    - import_role: 
        name: policies/hyperflex_policies/auto_support
      vars:
        hx_auto_support_policy: "{{ hx_cluster_name }}-auto-support-policy"
        hx_auto_support_enable: true
      when: execute_auto_support|bool
      tags: ['autosupport']
    # Proxy
    - import_role:
        name: policies/hyperflex_policies/proxy
      vars:
        hx_proxy_setting_policy: "{{ hx_cluster_name }}-proxy-setting-policy"
      when: execute_proxy|bool
      tags: ['proxy']
    # FC
    - import_role:
        name: policies/hyperflex_policies/fc
      vars:
        hx_fc_setting_policy: "{{ hx_cluster_name }}-ext-fc-storage-policy"
        hx_fc_setting_enable: true
      when: execute_fc|bool
      tags: ['fc']
    # iSCSI
    - import_role:
        name: policies/hyperflex_policies/iscsi
      vars:
        hx_iscsi_setting_policy: "{{ hx_cluster_name }}-ext-iscsi-storage-policy"
        hx_iscsi_setting_enable: true
      when: execute_iscsi|bool
      tags: ['iscsi']
    # Network Config
    - import_role:
        name: policies/hyperflex_policies/cluster_network
      vars:
        hx_cluster_network_policy: "{{ hx_cluster_name }}-cluster-network-policy"
      tags: ['network']
    # Node IP and Hostname
    - import_role:
        name: policies/hyperflex_policies/node_config
      vars:
        hx_node_config_policy: "{{ hx_cluster_name }}-node-config-policy"
      tags: ['nodes']

    - debug:
        msg: "All policies and the HyperFlex cluster profile have been created."

    - name: "Prompt to assign"
      pause:
        prompt: "Proceed with physical node assignment? (yes/no)"
        echo: yes
      register: assign_response
      run_once: true
      tags: ['prompt_assign']

    # Assign servers to cluster profile and set deployment action
    - import_role:
        name: policies/hyperflex_policies/node_profiles
      tags: ['assign']
      when: assign_response.user_input|bool

    - name: "Prompt to deploy"
      pause:
        prompt: "Proceed with cluster deployment? (yes/no)"
        echo: yes
      register: deploy_response
      run_once: true
      tags: ['prompt_deploy']

    # Set cluster profile deployment action
    - import_role:
        name: policies/hyperflex_policies/deploy
      tags: ['deploy']
      when: deploy_response.user_input|bool

    - debug:
        msg: "HyperFlex cluster creation is complete."