All Projects → tsailiming → ansible-hyperv

tsailiming / ansible-hyperv

Licence: other
Sample Ansible Playbook to provision VM on HyperV

Programming Languages

powershell
5483 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ansible-hyperv

BTPS-SecPack
This repository contains a collection of PowerShell tools that can be utilized to protect and defend an environment based on the recommendations of multiple cyber security researchers at Microsoft. These tools were created with a small to medium size enterprise environment in mind as smaller organizations do not always have the type of funding a…
Stars: ✭ 33 (-48.44%)
Mutual labels:  winrm
packer-vsphere-iso-windows
Create Packer Templates for Windows Server on VMware vSphere (and vCenter)
Stars: ✭ 73 (+14.06%)
Mutual labels:  winrm
lisa
LISA is developed and maintained by Microsoft, to empower Linux validation.
Stars: ✭ 110 (+71.88%)
Mutual labels:  hyperv
foreman hyperv
Microsoft Hyper-V compute resource for Foreman
Stars: ✭ 14 (-78.12%)
Mutual labels:  hyperv
Azure-WinRM-Terraform
Example Terraform plan for provisioning a Windows Server on Azure with WinRM
Stars: ✭ 19 (-70.31%)
Mutual labels:  winrm
Evil Winrm
The ultimate WinRM shell for hacking/pentesting
Stars: ✭ 2,251 (+3417.19%)
Mutual labels:  winrm
Win Acme
A simple ACME client for Windows (for use with Let's Encrypt et al.)
Stars: ✭ 4,305 (+6626.56%)
Mutual labels:  winrm
terraform examples
Terraform AWS Windows examples
Stars: ✭ 78 (+21.88%)
Mutual labels:  winrm
New-Machine
Utilizing Vagrant, Packer, Chocolatey, and Boxstarter to Configure my Dev Machines
Stars: ✭ 26 (-59.37%)
Mutual labels:  hyperv

Introduction

This is heavily inspired by glenndehaan's original code to provision a vm on HyperV.

The code has been modified to provision VMs by:

  • Cloning a disk
  • Setting up the IP
  • Powering on the VM
  • Wait for WinRM port to be available

The configuration is stored as an environment yaml file, such as vars/sit.yml. This is meant to allow the user to define the environments such as DEV/UAT/SIT and its associated network information for each vm.

Requirements

  • Win2012R2 vhd image with WinRM enabled. You can use Ansible's ConfigureRemotingForAnsible.ps1
  • MS SQL 2014 Express installer.
  • .Net Framework >= 4.0, if you want to run OrchardCMS, inclduding the setup.exe
  • OrchardCMS is downloaded from github releases

Playbooks

Creation of VM

There is a sample create_vm.yml playbook:

  • Provision a sit environment with 2 VMS and create the necessary groups: web and db
  • Configure static ips
  • wait_for WinRM is up before exiting

Building Golden Template

The playbook build_golden.yml is use to install the necessary software using roles. After building the image, you can then use the vhd in your environment yaml file.

Deploying Application

prov_web_db.yml is to provision the sample App_Data and restore a database from a backup from templates. The roles to install the IIS and MS-SQL have been disabled by default.

Deleting the VMs

Use delete_vm.yml to delete the vms and clean out the disk.

Running the playbook

You can change enviornment by either editing the var/ yaml files or using -e option in the command line.

Ansible Tower can also be used by using a survey form.

Script

There is a bin/run.ps1 sample script that calls Ansible Tower API to launch the Job Teamplate and monitor the job till it exits.

Credits

The various roles and PowerShell scripts are adopted from:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].