Giter VIP home page Giter VIP logo

gists's People

Contributors

dependabot[bot] avatar hwakabh avatar

gists's Issues

Add language-specific gitignore

Since .gitignore file can be nested, need to separate gitignore files according to each subdirectories.
The actual contents of gitignore would be fetched from following options:

Opt-1: Fetched from personal dotfile repository

$ curl -s -X GET https://raw.githubusercontent.com/hwakabh/dotfiles/main/gitconf/Python.gitignore

Opt-2: Fetched responses of www.gitignore.io API

$ curl -s -X GET https://www.toptal.com/developers/gitignore/api/python

Opt-3: Fetched from GitHub hosted repository

$ curl -s -X GET https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore

[kick_vm_restart_remotely]Add Scripts to collect mappings

As user requirements, they need to collect relations between:

  • Virtual-Machine name
  • ESXi Host name
  • Cluster name

The expected formats of output is .csv, so with Get-Cluster | Get-VMHost | Get-VM cmdlets, exporting the mapping information of vSphere objects.

[kick_vm_restart_remotely]Bugfix of setting script root path.

Currently when calling remote .ps1 script from parent server, the path of password.secret would be set as $HOME\Documents\, so that it could not retrieve proper credentials from SecureString objects same as in the password.secret file.

Need fix to retrieve encrypted password from the file password.secret on remote server by childScript.ps1.

[kick_vm_restart_remotely]Logging functions

  • Both in parentScript.ps1 and childScript.ps1, implement logging functions in eventvrw of Windows Server with New-EventLog Cmdlet.

  • Event Levels/IDs

    • INFO / TBD
    • WARNING / 801
    • ERROR / 901

[kick_vm_restart_remotely]Implement CP of childScript

In case of disconnection of vCenter Server, following features should be added to cp-childScript.ps1:

  • Connect to ESXi hosts directly instead of vCenter Server
  • Loop and find target virtual machine to restart with mapping file
  • Restart virtual machine with PowerCLI via ESXi hosts

[vsphere_maintenance]Bugfix to file redirections of downloading bundles

Currently Invoke-RestMethod returns following errors when they would download each log-bundle after completing the jobs to kick tasks of collecting.

Invoke-RestMethod : Access to the path 'C:\vmware' is denied.
At C:\Users\Administrator\Documents\misc-snippets\PowerShell\vsphere_maintenances\getNsxLogs.ps1:99 char:5
+     Invoke-RestMethod -Uri $postUri -Method Post -Headers $header -Bo ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-RestMethod], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
  • Fix to resolve this issue
  • Enable to dynamic filename with timestamps according to log-bundle types(Manager or Edge)

[vsphere_maintenance]Remove current hostProfiles within vCenter before getting new one

By design, vCenter Server would reject to create hostProfiles whose name is same as the ones vCenter have already created.

PS /Users/hwakabayashi> Get-VMHostProfile -Server vcsa02.nfvlab.local

Name                           Description
----                           -----------
default_test_profile           
default_test_profile_01        

PS /Users/hwakabayashi> 
PS /Users/hwakabayashi> 
PS /Users/hwakabayashi> Get-VMHostProfile -Server vcsa02.nfvlab.local |Select-Object -Property *
ServerId        : /VIServer=vsphere.local\administrator@vcsa02.nfvlab.local:443/
Server          : vcsa02.nfvlab.local
Description     : 
ReferenceHostId : HostSystem-host-106
ReferenceHost   : esxi08.nfvlab.local
Name            : default_test_profile
ExtensionData   : VMware.Vim.HostProfile
Id              : HostProfile-hostprofile-2
Uid             : /VIServer=vsphere.local\administrator@vcsa02.nfvlab.local:443/VMHostProfile=HostProfile-hostprofile-2/
PS /Users/hwakabayashi> 
PS /Users/hwakabayashi> 
PS /Users/hwakabayashi> New-VMHostProfile -Name default_test_profile -ReferenceHost esxi08.nfvlab.local
New-VMHostProfile : 11/20/2019 15:59:27 New-VMHostProfile  The name 'default_test_profile' already exists. 
At line:1 char:1
+ New-VMHostProfile -Name default_test_profile -ReferenceHost esxi08.nf ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [New-VMHostProfile], DuplicateName
+ FullyQualifiedErrorId : Client20_SystemManagementServiceImpl_NewVMHostProfile_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.NewVMHostProfile
 
PS /Users/hwakabayashi> 

To escape this issue, add the features to delete current hostProfiles if the name conflicts would occur, which would be run before getting/downloading hostProfiles.

[vsphere_maintenances]Validations of command line arguments

As almost all of the scripts are provided some command line arguments by user, such as name of clusters or virtual machines, implemented functions to check provided objects would truly exist on the system or not.

If not exists, in case that user would provide some wrong parameters, prompt to user that wrong arguments and stop to operations anymore.

[kick_vm_restart_remotely]Implement PowerCLI functionalities in childScript.ps1

  • For meeting requirements, need to implement functions below.
function getVmPowerState ($vmname) {
    Write-Host "WIP: Functions of getting VM power state..."
    Write-Host "Getting power status of $vmname ..."
}

...

function restartVm ($vmname) {
    Write-Host "WIP: Functions of restarting VM power state..."
    Write-Host "Restarting $vmname ..."
}

[vsphere_maintenances]Implement getNsxtLogs.ps1

  • Kick NSX-T's Policy-APIs, REST-APIs and execute tasks of collecting support-bundle.
    • Policy-APIs are implemented with NSX-T management cluster
  • Download or send with SCP to elsewhere with HTTP REST methods.

[vsphere_maintenance]Add configs to wait_interval

  • Added comments/descriptions to credentials.txt that which parameter each script would use.
# Common
...
# Parameters for A.ps1 
...
# Parameters for B.ps1 
...
  • For the scripts below, add the wait_interval for running command to each ESXi host.
    • setHostsMaintenanceMode.ps1
    • exitHostsMaintenanceMode.ps1
    • shutdownHosts.ps1
    • startAllVms.ps1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.