Skip to content

Instantly share code, notes, and snippets.

View format_ahv_open-vswitch.sh
#!/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 Apr 29, 2022
Nutanix Ansible Collection v1.0 でのテスト VM 作成。
View test-vm-01.yml
---
- 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 Dec 19, 2021
Nutanix AHV の Custom Script(Cloud-Init)で Terraform がインストールされた VM を作成する。(CentOS 8)
View terraform-centos8-vm.yml
#cloud-config
disable_root: true
ssh_pwauth: true
package_upgrade: false
users:
- name: nutanix
lock-passwd: false
sudo: ALL=(ALL) NOPASSWD:ALL
View nsx-t_dashboard_widget_advent_2021.json
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"
View nutanix-files_syslog-server-01.json
{
"spec": {
"name": "syslog-transfer-01",
"resources": {
"vendor_name": "syslog",
"usage_type": "NOTIFICATION",
"server_info": {
"address": {
"ip": "192.168.11.61",
"port": 514
@gowatana
gowatana / README.md
Last active Nov 24, 2021
VMUG vExpert が語る HOL。のサンプル | https://www.youtube.com/watch?v=vsuMcBxZ6-g
View README.md
View deploy_nsxt_edge_lab-edge-21.ps1
$ova_file = "C:\work\nsx-edge-3.1.2.0.0.17884008-le.ova"
$nsx_manager_thumbprint = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
$ovf_config = Get-OvfConfiguration -Ovf $ova_file
# DeploymentOption
$ovf_config.DeploymentOption.Value = "small"
# NetworkMapping
$ovf_config.NetworkMapping.Network_0.Value = "dvpg-0010-mgmt"
View deploy_nsxt_manager_lab-nsx-21.ps1
$ova_file = "C:\work\nsx-unified-appliance-3.1.2.0.0.17884005-le.ova"
$ovf_config = Get-OvfConfiguration -Ovf $ova_file
# DeploymentOption
$ovf_config.DeploymentOption.Value = "small"
# NetworkMapping
$ovf_config.NetworkMapping.Network_1.Value = "dvpg-0010-mgmt"
# Application
View get_esxi_cpuoc.ps1
Get-VMHost | Sort-Object Name | % {
$hv = $_
$hv_pcpu_count = $hv.NumCpu
$power_on_vms = $hv | Get-VM | where {$_.PowerState -eq "PoweredOn"}
$hv_vcpu_count = ($power_on_vms| Measure-Object -Sum NumCpu).Sum + 0
$hv_oc_percent = $hv_vcpu_count / $hv_pcpu_count * 100
"-----"
$hv.Parent.Name + "/" + $hv.Name + " ConnectionState:" + $hv.ConnectionState
"$hv_pcpu_count pCPU で、$hv_vcpu_count vCPU が起動中です。"
View create_share.yml
---
- name: Create Nutanix Files SMB Share
hosts: localhost
connection: local
gather_facts: no
vars_files:
- ./login.yml
vars:
fs_name: "test-fs-01"