Created
August 8, 2021 07:41
-
-
Save gowatana/a3ee3a772aad488d9f58bb10089524be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Create Nutanix Files File Server | |
hosts: localhost | |
connection: local | |
gather_facts: no | |
vars_files: | |
- ./login.yml | |
- ./login-ad.yml | |
vars: | |
ext_nw_name: "nw-vlan-31" | |
int_nw_name: "nw-vlan-20" | |
fs_name: "test-fs-01" | |
tasks: | |
- name: Get Network Info | |
uri: | |
url: "https://{{ prism_address }}:9440/api/nutanix/v2.0/networks" | |
method: GET | |
user: "{{ prism_username }}" | |
password: "{{ prism_password }}" | |
force_basic_auth: yes | |
validate_certs: "{{ validate_tls_certs }}" | |
status_code: 200 | |
register: nutanix_nw | |
- name: Get FSVM Storage Network UUID | |
vars: | |
query_strings: "json.entities[?name==`{{ int_nw_name }}`].uuid" | |
set_fact: | |
int_nw_uuid: "{{ nutanix_nw | json_query(query_strings) | first }}" | |
- name: Get FSVM Client Side Network UUID | |
vars: | |
query_strings: "json.entities[?name==`{{ ext_nw_name }}`].uuid" | |
set_fact: | |
ext_nw_uuid: "{{ nutanix_nw | json_query(query_strings) | first }}" | |
- name: Nutanix Files - Create File Server | |
uri: | |
url: "https://{{ prism_address }}:9440/PrismGateway/services/rest/v1/vfilers" | |
method: POST | |
user: "{{ prism_username }}" | |
password: "{{ prism_password }}" | |
body_format: json | |
force_basic_auth: yes | |
validate_certs: "{{ validate_tls_certs }}" | |
body: | |
name: "{{ fs_name }}" | |
sizeGib: 1024 | |
dnsDomainName: "{{ ad_domain_name }}" | |
numCalculatedNvms: 1 | |
numVcpus: 4 | |
memoryGiB: 12 | |
externalNetworks: | |
- uuid: "{{ ext_nw_uuid }}" | |
subnetMask: 255.255.255.0 | |
defaultGateway: 192.168.31.1 | |
pool: | |
- 192.168.31.11 192.168.31.11 | |
dnsServerIpAddresses: | |
- 192.168.10.170 | |
ntpServers: | |
- 192.168.10.170 | |
internalNetwork: | |
uuid: "{{ int_nw_uuid }}" | |
subnetMask: 255.255.255.0 | |
defaultGateway: 192.168.20.1 | |
pool: | |
- 192.168.20.91 192.168.20.91 | |
nameServicesDTO: | |
adDetails: | |
windowsAdDomainName: "{{ ad_domain_name }}" | |
windowsAdUsername: "{{ fs_admin_ad_user_name }}" | |
windowsAdPassword: "{{ fs_admin_ad_user_pass }}" | |
overwriteUserAccount: true | |
addUserAsFsAdmin: true | |
fsDnsOperationsDTO: | |
dnsOpType: MS_DNS | |
dnsUserName: "{{ fs_admin_ad_user_name }}" | |
dnsPassword: "{{ fs_admin_ad_user_pass }}" | |
pdName: "NTNX-{{ fs_name }}" | |
status_code: 200 | |
register: nutanix_task | |
- name: Check Nutanix Task | |
uri: | |
url: "https://{{ prism_address }}:9440/api/nutanix/v2.0/tasks/{{ nutanix_task.json.taskUuid }}" | |
method: GET | |
user: "{{ prism_username }}" | |
password: "{{ prism_password }}" | |
force_basic_auth: yes | |
validate_certs: "{{ validate_tls_certs }}" | |
status_code: 200 | |
register: nutanix_task_info | |
until: nutanix_task_info.json.progress_status == "Succeeded" | |
delay: 30 | |
retries: 60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
下記の投稿むけ。
Nutanix CE に Nutanix Files を展開する。(Ansible 編)
https://blog.ntnx.jp/entry/2021/08/08/172226