Skip to content

Instantly share code, notes, and snippets.

# VMの構成ファイルだけ別データストアに移動するスクリプト
#
# PowerCLIを使用して、個々のディスクを別々のデータストアに移行する方法
# https://communities.vmware.com/t5/-/-/m-p/3014244
# 配置指定
$vm_name = "test-vm01"
$target_ds_name_vmdk = "vsanDatastore" # VMDKのデータストア名
$target_ds_name_vmx = "ds-nfs-repo-01" # 構成ファイル移動先のデータストア名
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: hello-deployment
spec:
replicas: 1
template:
metadata:
labels:
@gowatana
gowatana / ahv_inventory.py
Last active May 7, 2023 06:19
ansible dynamic inventory script for Nutanix Prism
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import requests
# args = sys.argv
# conf_file = args[1]
conf_file = "/home/gowatana/prism-config.json"
NAME(GuestId) DESCRIPTION(GuestFullName) Since
amazonlinux2_64Guest Amazon Linux 2 (64 bit) vSphere API 6.7.1
asianux3_64Guest Asianux Server 3 (64 bit) vSphere API 4.0
asianux3Guest Asianux Server 3 vSphere API 4.0
asianux4_64Guest Asianux Server 4 (64 bit) vSphere API 4.0
asianux4Guest Asianux Server 4 vSphere API 4.0
asianux5_64Guest Asianux Server 5 (64 bit) vSphere API 6.0
asianux7_64Guest Asianux Server 7 (64 bit) vSphere API 6.5
asianux8_64Guest MIRACLE LINUX 8 (64-bit) vSphere API 6.7
centos6_64Guest CentOS 6 (64-bit) vSphere API 6.5
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dep-game2048
spec:
replicas: 1
selector:
matchLabels:
run: game2048
import sys
import json
import requests
args = sys.argv
conf_file = args[1]
if len(args) == 3:
output_format = args[2]
else:
output_format = 'list'
#!/bin/bash
# auther: gowatana
# usage:
# AHV# bash ./format_ahv_open-vswitch.sh
# or
# AHV# ovs-vsctl show > output.txt
# # bash ./format_ahv_open-vswitch.sh output.txt
OVS_FORMAT_FILE=./ovs-vsctl_show_formatted.txt
BRIDGE_NAME_1=br0
@gowatana
gowatana / test-vm-01.yml
Last active April 29, 2022 14:29
Nutanix Ansible Collection v1.0 でのテスト VM 作成。
---
- name: Create VM Playbook
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
tasks:
- name: Create VM
ntnx_vms:
nutanix_host: lab-nxce-01.go-lab.jp
@gowatana
gowatana / terraform-centos8-vm.yml
Created December 19, 2021 23:40
Nutanix AHV の Custom Script(Cloud-Init)で Terraform がインストールされた VM を作成する。(CentOS 8)
#cloud-config
disable_root: true
ssh_pwauth: true
package_upgrade: false
users:
- name: nutanix
lock-passwd: false
sudo: ALL=(ALL) NOPASSWD:ALL
cat << 'EOF' > nsx-t_dashboard_widget_advent_2021.json
{
"resource_type": "LabelValueConfiguration",
"display_name": "Japan vExperts Advent Calendar 2021",
"datasources": [
{
"urls": [
{
"alias": "dummy",
"url": "api/v1/cluster"