Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Project specific objects #
###########################
Tests/TestVars


# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Binary file added Media/lab-config-example.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Modules/PSWindowsUpdate.zip
Binary file not shown.
93 changes: 45 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,49 @@
Lab Config
======================
A collection of simple scripts that run against a vSphere environment to enforce consistency and enables self-healing on a regular basis. The premise is that you'd want to fill out a vars file with your standards, and then let the script engine run hourly / nightly / weekly to control drift and absorb new assets that are brought online.

## Description
Pretty straight forward. The engine's job is to start up a job for each script. Each script parses the vars file to determine what variables and options you want enforced.
- Set standards for a lab environment (which is what I do) and use a pull or utility server to run the engine on a schedule.
- Pick apart the scripts to use with other orchestration engines, or just as ideas for your code.

## Installation
Copy or fork the repo into your environment. Make sure you have PowerShell 4.0+ installed, along with PowerCLI 5.8+. The scripts are not signed, so you'll need to adjust your PowerShell ExecutionPolicy based on where you're running the engine file.

## Usage Instructions
Here's the scoop.

1. Update the vars.ps1 file with your domain specific information.
2. Decide how you wish to run the scripts:
2. Option 1: Run the engine.ps1 file, which will call all of the scripts in the various folders.
3. Option 2: If you don't want to run all of the scripts, open up the engine.ps1 file and edit the $jobMap variable and remove references to the scripts you wish to remove.
4. Option 3: Just ignore the engine.ps1 file and run the scripts individually. They will still use the vars.ps1 file and have some limited output to the console.

Here's an example of what the $jobMap var looks like:
```
$jobMap = [Ordered]@{
"DNS" = "\VMware\set-dns.ps1";
"NTP" = "\VMware\set-ntp.ps1";
"SSH" = "\VMware\set-ssh.ps1"
}
```

## Future
This is mainly a lab helper for Wahl Network, but I figured the code examples might be interesting to folks, or others with home labs might want to take advantage of the scripts.
- Microsoft scripts
- DNS for clients
- Network RSS settings
- WinRM control
- More 3rd party stuff
- PernixData is on my radar
- NSX perhaps?

## Contribution
Create a fork of the project into your own reposity. Make all your necessary changes and create a pull request with a description on what was added or removed and details explaining the changes in lines of code. If approved, project owners will merge it.

Licensing
---------
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This is a community project that aims to provide an extremely light-weight approach to vSphere configuration management using Pester and PowerCLI. Each component monitored is both tested and remediated against drift. The end-state configuration is abstracted into a simple config file. The entire project is written in PowerShell.

# Requirements

You'll just need a few free pieces of software.

1. PowerShell version 4+
2. [PowerCLI version 5.8+](http://www.vmware.com/go/powercli)
5. [Pester](https://github.com/pester/Pester)
4. (optional) [Windows Management Framework 5.0](https://www.microsoft.com/en-us/download/details.aspx?id=50395)

# Installation

Download the files contained within this project anywhere you want. You can even make different copies for different environments.

# Usage Instructions

1. Edit the `Config.ps1` file with your specific environmental variables for DRS, NTP, SSH, etc.
1. Open a PowerShell console.
2. Navigate to the project folder that you downloaded.
3. Run `Invoke-Pester` to launch the tests.

![Example](/Media/lab-config-example.jpg?raw=true "Example")

# Future

Support
-------
Please file bugs and issues at the Github issues page. The code and documentation are released with no warranties or SLAs and are intended to be supported through a community driven process.
The community module is not officially supported and should be **used at your own risk**.

I'd like to see more tests added for things people find important. This will be done as time permits. :)

# Contribution

Everyone is welcome to contribute to this project. Here are the steps involved:

1. Create a fork of the project into your own repository.
2. From your fork, create a new feature branch (other than master) that expresses your feature or enhancement.
3. Make all your necessary changes in your feature branch.
4. Create a pull request with a description on what was added or removed and details explaining the changes in lines of code.

If approved, project owners will merge it.

# Licensing

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Binary file added Templates/Update-Template.ps1
Binary file not shown.
42 changes: 42 additions & 0 deletions Tests/Config.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
$global:config = @{}

### Pester Settings

$global:config.pester = @{
remediate = $true
}

### vCenter Settings

$global:config.vcenter = @{
vc = 172.17.48.17
}

### Cluster Settings

$global:config.cluster = @{
drsmode = 'FullyAutomated'
drslevel = 2
}

### ESXi Host Settings

$global:config.host = @{
sshenable = $true
sshwarn = 1
esxntp = @('0.pool.ntp.org', '1.pool.ntp.org', '2.pool.ntp.org', '3.pool.ntp.org')
esxdns = @('172.17.48.11', '172.17.48.12')
searchdomains = @('rubrik.demo')
esxsyslog = @('tcp://172.16.20.243:514')
}

# Tegile Zebi array settings

$global:config.nfsadvconfig = @{
'NFS.MaxQueueDepth' = 32
'NFS.DeleteRPCTimeout' = 30
'NFS.HeartbeatFrequency' = 20
'NFS.MaxVolumes' = 256
'Net.TcpipHeapSize' = 32
'Net.TcpipHeapMax' = 1536
}
Binary file added Tests/Update-DNS.Tests.ps1
Binary file not shown.
Binary file added Tests/Update-DRS.Tests.ps1
Binary file not shown.
Binary file added Tests/Update-NFS.Tests.ps1
Binary file not shown.
Binary file added Tests/Update-NTP.Tests.ps1
Binary file not shown.
Binary file added Tests/Update-SSH.Tests.ps1
Binary file not shown.
Binary file added Tests/Update-Syslog.Tests.ps1
Binary file not shown.
51 changes: 0 additions & 51 deletions VMware/remove-allocations.ps1

This file was deleted.

34 changes: 0 additions & 34 deletions VMware/remove-media.ps1

This file was deleted.

64 changes: 0 additions & 64 deletions VMware/set-dns.ps1

This file was deleted.

45 changes: 0 additions & 45 deletions VMware/set-drs.ps1

This file was deleted.

Loading