Wednesday, October 3, 2018

Desired State Configuration With Powershell

DSC is management platform, used to manage your IT infrastructure, presenting configuration as code.
So this code is just powershell script which contains Windows features or roles needs to be maintained with comply of your organisation. Code would be pushed to the Nodes where this code need to maintain Configuration settings.
DSC not only maintains the configuration of the nodes but also monitor and can provide alerts is a node is not compliant.
lthough DSC was introduced in Windows Server 2012 R2, it is available for down-level operating systems via the Windows Management Framework (WMF) package.


Some of the benefits of Desired State Configuration:
* To automate the configuration tasks for one or more nodes
* To standardize the nodes with same set of configuration
* Faster deployments and reliable
* Monitor the compliance state of nodes and can automatically fix it(Make it compliant)

There are two types of architecture with DSC:

Push mode: the configurations are sent (“pushed”) manually towards one or more units that we call “node”. This action is done by an administrator.
Pull mode: a “pull server” is created and the nodes contact this server at regular intervals so as to obtain their configuration.

There are 3 components of Desired State Configuration in Powershell:

1. Local Configuration Manager - Engine which facilitates the Pull and Push mode of the system. It control flow implemented by resources to ensure that the state defined in configuration is maintained.
2. Configuration Files - Declarative powershell scripts which can be applied repeatedly and will always give the same result and it won’t generate errors if the configuration was already applied.
3. Resources - contain the code that put and keep the target of a configuration in the specified state. Resources reside in PowerShell modules and can be written to model something as generic as a file or a Windows process, or as specific as an IIS server or a VM running in Azure.

Lets Make a Small DSC example:

Two Files need to be created -
1. Default.html
2. CreateWebsite.ps1

Scenario - We need to install WebServer Role in node with default page.

Paste Below in Default.html

<head>Test Page</head>
<body>
<p>Sample for Desired state configuration in Powershell</p>
</body>

Paste Below in CreateWebsite.ps1

Configuration CreateWebsite {

 
    Import-DscResource -ModuleName PsDesiredStateConfiguration

    Node 'VMSRV1' {

        WindowsFeature WebServer {
            Ensure = "Present"
            Name   = "Web-Server"
        }

        File WebsiteContent {
            Ensure = 'Present'
            SourcePath = 'c:\temp\Default.html'
            DestinationPath = 'c:\inetpub\wwwroot'
        }
    }
}

Steps to Run:
1. First you need to compile the CreateWebsite.ps1 file, You can verify the output by going to Present Directory where script is running and check if MOF(Managed Object Format) file is create with name "VMSVR1".
2. To Apply the configuration which we created, use command "Start-DscConfiguration ./CreateWebsite.ps1"
3. It will show some output, after execution is completed. Please check if IIS role has been installed and you can see default website with Default.html which we created.

Monday, October 1, 2018

Quick Look to VMware SRM(Site Recovery Manager)

Vmware Site Recovery Manager

========================
1. Vmware SRM is disaster recovery and business continuity solution which automates the tranfer of virtual machines to a local or remote recovery site.
2. It is an extension of vcenter server
3. SRM automates the recovery or migration of virtual machines between protected site and recovery site. Protected site is primary site and recovery site is the datacenter location ewhere yoiu want to move your production workloads.
4. SRM facilirates the clean shutdown of virtual machines at the protected site for a planned migration.
5. VMware SRM is used with array-based replication software. you can also use vmware native replicatoin copies virtal machines from one host to another using the power of the hosts involved rather than the storage system.
6. Below are the high level recommendation to setup SRM:
* vSphere environment including vCenter should be deployed on both Protected site and recovery site.
* Array based replication is established between protected and recovery site using third party storage vendors. Optionally you can utilize vSphere Replication as a native solution, if you don’t have array based replication.
* VMware Site recovery manager software needs to be installed on both Protected and recovery site.
* VMware Administrators use SRM to create disaster recovery plans.
* VMware Administrator can use recovery plans to initiate Recovery tests or actual recovery.
7. Since SRM 5.6, SRM plugin integrated only with web client and no plugins available for vsphere client.
8. VR appliance - This used to be called the VRMS and provided management capabilities for the VR framework. This is function persists in the VR appliance and VRS functionality has been integrated with the appliance.
9. VR Server - An optional scaling component. This provides a replication target. This functionality is included in the VR appliance, but to scale to higher than 100 replications, additional VR server instances can be deployed.
10. vSphere Replication Agent(VRA) Present on every vsphere host, it only becomes active when protected VM is wirting data.
11. Network file copy(NFC) - Protocol is used to commit network based disk writed by vSphere. The VRS received replicated blocks and distributes them via NFC to the vsphere hosts for writing to storage.

Installation and Configuring SRM
===========================

1. SRM 6.0 is a software component and it can be installed separately on dedicated server or installed with the same server where vcenter server is installed.
2. If you have vcenter as appliance, you will need separate windows server for SRM.
3. You can use embedded Postgres database or external database like MSSQL or Oracle. For using external database, you need to create DSN for the same.
4. Time sync is important between both SRM server(Protected site & Recovery site). Please sync with central NTP server before pairing sites.
5. Account used for installation and configuration muse be admin account with privileges to install and run SRM service.

SRM site pairing
=============

1. Once you have installed SRM in both sites, you can login to vcenter web client and click "Site Recovery" plugin.
2. You must see the sites on the left pane. Click on the the sites button and in summary frame you can see the "Pair Sites" link.
3. Provide the Platform service controller address of your SRM remote site (recovery site).The address that you provide for the Platform Services Controller must be an exact match of the of address that you provided when you installed Site Recovery Manager Server on the remote site.
4. Next you need to provided credential, you entered while installation of SRM.
5. Once it is done, you see detials of paired sites in summary tab.


Windows Server 2016 Key Features and License Prospects

If you are planning to move to Windows 2016 and looking for benefits, I have listed down below : Why Windows Server 2016? ·     ...