Skip to content

Instantly share code, notes, and snippets.

View Akasurde's full-sized avatar
🌏
To the infinity and beyond

Abhijeet Kasurde Akasurde

🌏
To the infinity and beyond
View GitHub Profile
@Akasurde
Akasurde / create_category.yml
Created November 27, 2020 05:24
Category creation
---
- hosts: localhost
gather_facts: no
tasks:
- name: Create category for backup
community.vmware.vmware_category:
category_name: "backup_category"
category_description: "Backup Category Description"
category_cardinality: "multiple"
associable_object_types:
from pyVim.connect import SmartConnect, Disconnect
import ssl
import atexit
from pyVmomi import vim, vmodl, VmomiSupport
def connect(hostname, username, password, port):
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.verify_mode = ssl.CERT_NONE
si = SmartConnect(host=hostname,
from pyVim.connect import SmartConnect, Disconnect
import ssl
import atexit
from pyVmomi import vim
# vim.vm.GuestOsDescriptor.GuestOsIdentifier
def connect(hostname, username, password, port):
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.verify_mode = ssl.CERT_NONE
@Akasurde
Akasurde / main.py
Created October 27, 2020 08:24
scribd document download
import requests
from bs4 import BeautifulSoup
import os
import shutil
url = ""
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
@Akasurde
Akasurde / main.yml
Created October 20, 2020 08:54
A playbook to create a DRS rule using Ansible
---
- hosts: localhost
gather_facts: no
vars_files:
- vcenter_vars.yml
tasks:
- name: Create a DRS anti-affinity rule for Asia-Cluster1
community.vmware.vmware_vm_vm_drs_rule:
validate_certs: False
hostname: '{{ vcenter_hostname }}'
@Akasurde
Akasurde / main.yml
Last active October 24, 2021 18:31
A playbook to create a Windows VM in vCenter environment
---
- hosts: localhost
vars_files:
- vcenter_vars.yml
tasks:
- name: Create a Windows VM
vmware_guest:
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
@Akasurde
Akasurde / gist.xml
Created October 13, 2020 10:29
First Logon commands in Autounattended.xml
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>powershell -ExecutionPolicy ByPass Invoke-Expression (Invoke-WebRequest -Uri http://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1)</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>2</Order>
<CommandLine>powerShell "Invoke-WebRequest -Uri http://packages.vmware.com/tools/esx/6.7u2/windows/x64/VMware-tools-10.3.5-10430147-x86_64.exe -OutFile C:\Windows\temp\VMware-tools-10.3.5-10430147-x86_64.exe"</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
@Akasurde
Akasurde / enable_ssh_service.yml
Created October 6, 2020 06:28
Enable SSH service on the given ESXi host system
- name: Start SSH service setting for an ESXi Host in given Cluster
vmware_host_service_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: esxi_name
service_name: TSM-SSH
state: present
@Akasurde
Akasurde / main.yml
Created October 6, 2020 05:45
Automate CentOS 7 installation using Kickstart and vmware_guest module
---
- hosts: localhost
gather_facts: no
vars_files:
- vcenter_vars.yml
vars:
hostname: kickstart_vm
tasks:
- name: Boot VM with CentOS 7 installation iso in CDROM
vmware_guest:
@Akasurde
Akasurde / vcsa-kvm.yml
Created July 20, 2020 08:21 — forked from infernix/vcsa-kvm.yml
Create a VMware VCSA appliance under KVM with libvirt and ansible
---
- name: Generate a KVM enabled VMWare VCSA VM under libvirt
hosts: 127.0.0.1
connection: local
vars:
- reqpkgs_apt:
- bsdtar
- libguestfs-tools
- qemu-utils
- virtinst