Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit 43eb31f

Browse files
authored
Merge pull request #3 from WahlNetwork/refactor
Refactor
2 parents 63fc5c7 + d554f97 commit 43eb31f

24 files changed

+129
-470
lines changed

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Project specific objects #
2+
###########################
3+
Tests/TestVars
4+
5+
6+
# Compiled source #
7+
###################
8+
*.com
9+
*.class
10+
*.dll
11+
*.exe
12+
*.o
13+
*.so
14+
15+
# Packages #
16+
############
17+
# it's better to unpack these files and commit the raw source
18+
# git has its own built in compression methods
19+
*.7z
20+
*.dmg
21+
*.gz
22+
*.iso
23+
*.jar
24+
*.rar
25+
*.tar
26+
*.zip
27+
28+
# Logs and databases #
29+
######################
30+
*.log
31+
*.sql
32+
*.sqlite
33+
34+
# OS generated files #
35+
######################
36+
.DS_Store
37+
.DS_Store?
38+
._*
39+
.Spotlight-V100
40+
.Trashes
41+
ehthumbs.db
42+
Thumbs.db

Media/lab-config-example.jpg

213 KB
Loading

Modules/PSWindowsUpdate.zip

-44.7 KB
Binary file not shown.

README.md

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
11
Lab Config
22
======================
3-
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.
4-
5-
## Description
6-
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.
7-
- 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.
8-
- Pick apart the scripts to use with other orchestration engines, or just as ideas for your code.
9-
10-
## Installation
11-
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.
12-
13-
## Usage Instructions
14-
Here's the scoop.
15-
16-
1. Update the vars.ps1 file with your domain specific information.
17-
2. Decide how you wish to run the scripts:
18-
2. Option 1: Run the engine.ps1 file, which will call all of the scripts in the various folders.
19-
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.
20-
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.
21-
22-
Here's an example of what the $jobMap var looks like:
23-
```
24-
$jobMap = [Ordered]@{
25-
"DNS" = "\VMware\set-dns.ps1";
26-
"NTP" = "\VMware\set-ntp.ps1";
27-
"SSH" = "\VMware\set-ssh.ps1"
28-
}
29-
```
30-
31-
## Future
32-
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.
33-
- Microsoft scripts
34-
- DNS for clients
35-
- Network RSS settings
36-
- WinRM control
37-
- More 3rd party stuff
38-
- PernixData is on my radar
39-
- NSX perhaps?
40-
41-
## Contribution
42-
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.
43-
44-
Licensing
45-
---------
46-
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>
473

48-
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.
4+
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.
5+
6+
# Requirements
7+
8+
You'll just need a few free pieces of software.
9+
10+
1. PowerShell version 4+
11+
2. [PowerCLI version 5.8+](http://www.vmware.com/go/powercli)
12+
5. [Pester](https://github.com/pester/Pester)
13+
4. (optional) [Windows Management Framework 5.0](https://www.microsoft.com/en-us/download/details.aspx?id=50395)
14+
15+
# Installation
16+
17+
Download the files contained within this project anywhere you want. You can even make different copies for different environments.
18+
19+
# Usage Instructions
20+
21+
1. Edit the `Config.ps1` file with your specific environmental variables for DRS, NTP, SSH, etc.
22+
1. Open a PowerShell console.
23+
2. Navigate to the project folder that you downloaded.
24+
3. Run `Invoke-Pester` to launch the tests.
25+
26+
![Example](/Media/lab-config-example.jpg?raw=true "Example")
27+
28+
# Future
4929

50-
Support
51-
-------
52-
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.
30+
The community module is not officially supported and should be **used at your own risk**.
31+
32+
I'd like to see more tests added for things people find important. This will be done as time permits. :)
33+
34+
# Contribution
35+
36+
Everyone is welcome to contribute to this project. Here are the steps involved:
37+
38+
1. Create a fork of the project into your own repository.
39+
2. From your fork, create a new feature branch (other than master) that expresses your feature or enhancement.
40+
3. Make all your necessary changes in your feature branch.
41+
4. Create a pull request with a description on what was added or removed and details explaining the changes in lines of code.
42+
43+
If approved, project owners will merge it.
44+
45+
# Licensing
46+
47+
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
48+
49+
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.

Templates/Update-Template.ps1

1.71 KB
Binary file not shown.

Tests/Config.ps1

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
$global:config = @{}
2+
3+
### Pester Settings
4+
5+
$global:config.pester = @{
6+
remediate = $true
7+
}
8+
9+
### vCenter Settings
10+
11+
$global:config.vcenter = @{
12+
vc = 172.17.48.17
13+
}
14+
15+
### Cluster Settings
16+
17+
$global:config.cluster = @{
18+
drsmode = 'FullyAutomated'
19+
drslevel = 2
20+
}
21+
22+
### ESXi Host Settings
23+
24+
$global:config.host = @{
25+
sshenable = $true
26+
sshwarn = 1
27+
esxntp = @('0.pool.ntp.org', '1.pool.ntp.org', '2.pool.ntp.org', '3.pool.ntp.org')
28+
esxdns = @('172.17.48.11', '172.17.48.12')
29+
searchdomains = @('rubrik.demo')
30+
esxsyslog = @('tcp://172.16.20.243:514')
31+
}
32+
33+
# Tegile Zebi array settings
34+
35+
$global:config.nfsadvconfig = @{
36+
'NFS.MaxQueueDepth' = 32
37+
'NFS.DeleteRPCTimeout' = 30
38+
'NFS.HeartbeatFrequency' = 20
39+
'NFS.MaxVolumes' = 256
40+
'Net.TcpipHeapSize' = 32
41+
'Net.TcpipHeapMax' = 1536
42+
}

Tests/Update-DNS.Tests.ps1

3.76 KB
Binary file not shown.

Tests/Update-DRS.Tests.ps1

4.14 KB
Binary file not shown.

Tests/Update-NFS.Tests.ps1

2.91 KB
Binary file not shown.

Tests/Update-NTP.Tests.ps1

3.23 KB
Binary file not shown.

0 commit comments

Comments
 (0)