SlideShare a Scribd company logo
1 of 38
Download to read offline
Nano Server
Puppet + DSC
Michael Smith, Developer @ Puppet
Nano Server: Puppet + DSC 2
What is Nano Server?

Why would we use it?

Limitations

How to start

How does Puppet fit in
Nano Server: Puppet + DSC 3
What is Nano Server?
Nano Server: Puppet + DSC 4
Nano Server: Puppet + DSC 5
A lightweight Windows Server
Source: http://windowsitpro.com/windows-server-2016/install-options-windows-server-2016
Nano Server: Puppet + DSC 6
A much faster virtual server
Source: http://www.techradar.com/news/software/operating-systems/why-nano-server-is-the-most-vital-change-to-windows-server-since-windows-nt-3-5-1295803
Nano Server: Puppet + DSC 7
Why Do I Care?
8
Nano Server: Puppet + DSC 9
Limitations
Nano Server: Puppet + DSC
No GUI, just PowerShell/cmd

64-bit only

No MSI, new Windows Server Apps (WSA)

Minimal configuration (no ADSI, no Group Policy)

.Net CoreCLR

Deprecated functions removed - https://goo.gl/48IZV6

Limited PowerShell support
10
Nano Server: Puppet + DSC 11
Getting Nano Server
Nano Server: Puppet + DSC 12
Hyper-V: Command-Line https://goo.gl/RDOUwA
$password = ConvertTo-SecureString -AsPlaintext -Force 'vagrant'
New-NanoServerImage 
-MediaPath 'E:' 
-Edition 'Datacenter' 
-DeploymentType Guest 
-AdministratorPassword 'vagrant' 
-TargetPath 'C:NanoVM.vhd' 
-MaxSize 8589934592 
-SetupUI ('NanoServer.Containers', 'NanoServer.DSC') 
-SetupCompleteCommand ('tzutil.exe /s "Pacific Standard Time"') 
-LogPath 'C:TempNanoServerImageBuilderLogs2016-10-16 12-29'
Nano Server: Puppet + DSC 13
Nano Server Image Builder https://goo.gl/IEFU9d
Nano Server: Puppet + DSC 14
Server Feature Packages
Nano Server: Puppet + DSC 15
Configuration SimpleVM {
param (
[string[]]$NodeName = 'localhost',
[string]$VhdPath
)
Import-DscResource -ModuleName xHyper-V
Node $NodeName {
xVMSwitch internal {
Ensure = 'Present'
Name = 'internal'
Type = 'Internal'
}
xVMHyperV SimpleVM {
Ensure = 'Present'
Name = 'SimpleVM'
VhdPath = $VhdPath
SwitchName = 'internal'
State = 'Running'
Generation = 1
StartupMemory = 512MB
ProcessorCount = 1
DependsOn = '[xVMSwitch]internal'
}
}
}
SimpleVM -VhdPath 'C:/VM/NanoServerDataCenter.vhd'
Desired State Configuration (DSC)
Nano Server: Puppet + DSC 16
puppetlabs-dsc
dsc_xVMHyperV { 'SimpleVM':
dsc_ensure => present,
dsc_name => 'SimpleVM',
dsc_vhdpath => 'C:/VM/
NanoServerDataCenter.vhd',
dsc_switchname => 'internal',
dsc_state => 'running',
dsc_generation => 1,
dsc_startupmemory => 536870912,
dsc_processorcount => 1,
require => Dsc_XVMSwitch['internal'],
}
dsc_xVMSwitch { 'internal':
dsc_ensure => 'present',
dsc_name => 'internal',
dsc_type => 'Internal',
}
Nano Server: Puppet + DSC 17
Demos
GitHub:MikaelSmith/puppetconf2016
Nano Server: Puppet + DSC 18
Hyper-V Demo
https://github.com/MikaelSmith/puppetconf2016#hyper-v-demo
Nano Server: Puppet + DSC 19
Hacks upon Hacks
https://github.com/PowerShell/xStorage/pull/60

https://tickets.puppetlabs.com/browse/MODULES-3690

https://tickets.puppetlabs.com/browse/MODULES-3831

Everything’s broken

… but getting fixed.
Nano Server: Puppet + DSC 20
Vagrant/Virtualbox
Enable-PSRemoting -Force
Set-Item wsman:localhostclienttrustedhosts -Value localhost -Force
$pw = ConvertTo-SecureString -asPlainText -Force "vagrant"
$c = New-Object System.Management.Automation.PSCredential("vagrant", $pw)
Enter-PSSession -ComputerName localhost -Port 55985 -Credential $c
Vagrant Boxes: https://goo.gl/RSGdHN

PowerShell Remoting
rwinrm vagrant@127.0.0.1:55985
https://github.com/WinRb/WinRM
Demo: https://github.com/MikaelSmith/puppetconf2016#build-vagrant-box
Nano Server: Puppet + DSC 21
Vagrant Demo
Nano Server: Puppet + DSC 22
Docker https://goo.gl/Vp5CQB
Source: http://windowsitpro.com/windows-server-2016/differences-between-windows-containers-and-hyper-v-containers-windows-server-201
Nano Server: Puppet + DSC
FROM microsoft/nanoserver
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 4.6.1
ENV NODE_SHA256 f576f2dacc4262202ae21f7d64ab9a01b7e551795848dfa39ef39a2cd63fa42c
RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; 
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:node.zip', 'C:') ; 
Rename-Item -Path $('C:node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:nodejs' ; 
New-Item $($env:APPDATA + 'npm') ; 
$env:PATH = 'C:nodejs;{0}npm;{1}' -f $env:APPDATA, $env:PATH ; 
Set-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlSession ManagerEnvironment' -Name Path -Value $env:PATH ; 
Remove-Item -Path node.zip
CMD [ "node.exe" ]
23
Dockerfiles https://goo.gl/kcTctx
Source: https://github.com/StefanScherer/dockerfiles-windows/blob/e7a938a9e32fe89e6d5aa232054971ad91e98ac7/node/4.6/nano/Dockerfile
Base Node Container
Nano Server: Puppet + DSC 24
FROM node:4.6.1-nano



RUN mkdir app 

WORKDIR /app



ONBUILD COPY package.json package.json 

ONBUILD RUN npm install 

ONBUILD COPY . .



CMD [ "npm.cmd", "start" ]
Dockerfiles, Cont.
Source: https://github.com/StefanScherer/dockerfiles-windows/blob/e7a938a9e32fe89e6d5aa232054971ad91e98ac7/node/4.6/nano/onbuild/Dockerfile
FROM nano:4.6.1-nano-onbuild
Node Onbuild Template
Application Builder
Nano Server: Puppet + DSC 25
Docker Demo
https://github.com/MikaelSmith/puppetconf2016#docker-demo
Nano Server: Puppet + DSC
https://github.com/MikaelSmith/puppet-agent/tree/nano-hacks

https://github.com/MikaelSmith/puppetconf2016#docker-demo

Track 5: Modern Infrastructure

Running Puppet Software in Docker Containers - Gareth Rushgrove

Kubernetes: Add Windows Containers Support

https://github.com/kubernetes/kubernetes/issues/22623
26
Containers
Nano Server: Puppet + DSC 27
Adding Puppet
Nano Server: Puppet + DSC 28
Things that work
Core Resources
file, host, exec

Modules
- puppetlabs-reboot

- Puppetlabs-acl

Maybe
- puppetlabs-powershell (after MODULES-3690, 3990)

- puppetlabs-dsc (after MODULES-3831)
Nano Server: Puppet + DSC 29
Registry + DSC
dsc_registry { 'enable long paths':
dsc_ensure => present,
dsc_key => 'HKEY_LOCAL_MACHINESystemCurrentControlSetPolicies',
dsc_valuename => 'LongPathsEnabled',
dsc_valuedata => '1',
Dsc_valuetype => 'DWORD',
}
Source: http://winaero.com/blog/how-to-enable-ntfs-long-paths-in-windows-10/
Nano Server: Puppet + DSC
Core Resources
- user (requires ADSI)

- group (requires ADSI)

- package (no appx support yet)

- scheduled_task (requires mstask.dll)

Modules
- puppet-iis (based on PowerShell WebAdministration)

- many others
30
Things that don’t (yet)
Nano Server: Puppet + DSC 31
$username = 'vagrant'
$password = 'vagrant'
$groupname = 'puppet'
Users & Groups
exec { 'puppet group':
command => "New-LocalGroup -Name ${groupname}",
unless => "Get-LocalGroup -Name ${groupname}",
provider => powershell,
}
Nano Server: Puppet + DSC 32
exec { 'vagrant user in puppet group':
command => "Add-LocalGroupMember -Group ${groupname} -Member ${username}",
unless => "Get-LocalGroupMember -Group ${groupname} -Member ${username}",
provider => powershell,
require => [Exec['puppet group'], Exec['vagrant user']],
}
Users & Groups, Cont.
exec { 'vagrant user':
command => "New-LocalUser -Name ${username} -Password 
(ConvertTo-SecureString -AsPlainText "${password}" -Force)",
unless => "Get-LocalUser -Name ${username}",
provider => powershell,
}
Nano Server: Puppet + DSC 33
Puppet Demo
https://github.com/MikaelSmith/puppetconf2016#puppet-demo
Nano Server: Puppet + DSC 34
Packaging
https://github.com/mikaelsmith/puppetconf2016#packaging-demo
Nano Server: Puppet + DSC 35
Debugging Problems
https://github.com/mikaelsmith/puppetconf2016#debugging-problems-demo
Nano Server: Puppet + DSC
Ways to get started
Hyper-V directly, Docker, Virtualbox/Vagrant

Tools to improve
PowerShell, DSC modules, Puppet modules, Puppet core
resources, applications, Vagrant, Packer, etc.
36
Nano Server: Puppet + DSC 37
http://www.hurryupandwait.io/
https://cloudbase.it/
Nano Server: Puppet + DSC 38
Thanks!
Questions?

More Related Content

What's hot

What's hot (20)

Zero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google CloudZero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google Cloud
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Containerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and JavaContainerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and Java
 
DevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal DeploymentDevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal Deployment
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
dkr_django_slides
dkr_django_slidesdkr_django_slides
dkr_django_slides
 
Kubelet with no Kubernetes Masters | DevNation Tech Talk
Kubelet with no Kubernetes Masters | DevNation Tech TalkKubelet with no Kubernetes Masters | DevNation Tech Talk
Kubelet with no Kubernetes Masters | DevNation Tech Talk
 
Hide your development environment and application in a container
Hide your development environment and application in a containerHide your development environment and application in a container
Hide your development environment and application in a container
 
Continuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and JenkinsContinuous Integration/Deployment with Docker and Jenkins
Continuous Integration/Deployment with Docker and Jenkins
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
 
Pragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecturePragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecture
 
Magento 2 Capistrano Deploy
Magento 2 Capistrano DeployMagento 2 Capistrano Deploy
Magento 2 Capistrano Deploy
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
 
Docker deploy
Docker deployDocker deploy
Docker deploy
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
Modern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with PuppetModern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with Puppet
 
Intro 2 docker
Intro 2 dockerIntro 2 docker
Intro 2 docker
 

Similar to PuppetConf 2016: Building Nano Server Images with Puppet and DSC – Michael Smith, Puppet

Presentation iv implementasi 802x eap tls peap mscha pv2
Presentation iv implementasi  802x eap tls peap mscha pv2Presentation iv implementasi  802x eap tls peap mscha pv2
Presentation iv implementasi 802x eap tls peap mscha pv2
Hell19
 

Similar to PuppetConf 2016: Building Nano Server Images with Puppet and DSC – Michael Smith, Puppet (20)

PuppetConf 2016: Nano Server, Puppet, and DSC
PuppetConf 2016: Nano Server, Puppet, and DSCPuppetConf 2016: Nano Server, Puppet, and DSC
PuppetConf 2016: Nano Server, Puppet, and DSC
 
Puppet + Windows Nano Server
Puppet + Windows Nano ServerPuppet + Windows Nano Server
Puppet + Windows Nano Server
 
Tensorflow in Docker
Tensorflow in DockerTensorflow in Docker
Tensorflow in Docker
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Presentation iv implementasi 802x eap tls peap mscha pv2
Presentation iv implementasi  802x eap tls peap mscha pv2Presentation iv implementasi  802x eap tls peap mscha pv2
Presentation iv implementasi 802x eap tls peap mscha pv2
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloud
 
Couch to OpenStack: Nova - July, 30, 2013
Couch to OpenStack: Nova - July, 30, 2013Couch to OpenStack: Nova - July, 30, 2013
Couch to OpenStack: Nova - July, 30, 2013
 
Freeradius edir
Freeradius edirFreeradius edir
Freeradius edir
 
Nagios Conference 2012 - Mike Weber - Failover
Nagios Conference 2012 - Mike Weber - FailoverNagios Conference 2012 - Mike Weber - Failover
Nagios Conference 2012 - Mike Weber - Failover
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmaple
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Shifter: Containers in HPC Environments
Shifter: Containers in HPC EnvironmentsShifter: Containers in HPC Environments
Shifter: Containers in HPC Environments
 
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorial
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
 
DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabDPDK in Containers Hands-on Lab
DPDK in Containers Hands-on Lab
 
Delivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesDelivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devices
 

More from Puppet

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
Puppet
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
Puppet
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
Puppet
 

More from Puppet (20)

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

PuppetConf 2016: Building Nano Server Images with Puppet and DSC – Michael Smith, Puppet

  • 1. Nano Server Puppet + DSC Michael Smith, Developer @ Puppet
  • 2. Nano Server: Puppet + DSC 2 What is Nano Server? Why would we use it? Limitations How to start How does Puppet fit in
  • 3. Nano Server: Puppet + DSC 3 What is Nano Server?
  • 5. Nano Server: Puppet + DSC 5 A lightweight Windows Server Source: http://windowsitpro.com/windows-server-2016/install-options-windows-server-2016
  • 6. Nano Server: Puppet + DSC 6 A much faster virtual server Source: http://www.techradar.com/news/software/operating-systems/why-nano-server-is-the-most-vital-change-to-windows-server-since-windows-nt-3-5-1295803
  • 7. Nano Server: Puppet + DSC 7 Why Do I Care?
  • 8. 8
  • 9. Nano Server: Puppet + DSC 9 Limitations
  • 10. Nano Server: Puppet + DSC No GUI, just PowerShell/cmd 64-bit only No MSI, new Windows Server Apps (WSA) Minimal configuration (no ADSI, no Group Policy) .Net CoreCLR Deprecated functions removed - https://goo.gl/48IZV6 Limited PowerShell support 10
  • 11. Nano Server: Puppet + DSC 11 Getting Nano Server
  • 12. Nano Server: Puppet + DSC 12 Hyper-V: Command-Line https://goo.gl/RDOUwA $password = ConvertTo-SecureString -AsPlaintext -Force 'vagrant' New-NanoServerImage -MediaPath 'E:' -Edition 'Datacenter' -DeploymentType Guest -AdministratorPassword 'vagrant' -TargetPath 'C:NanoVM.vhd' -MaxSize 8589934592 -SetupUI ('NanoServer.Containers', 'NanoServer.DSC') -SetupCompleteCommand ('tzutil.exe /s "Pacific Standard Time"') -LogPath 'C:TempNanoServerImageBuilderLogs2016-10-16 12-29'
  • 13. Nano Server: Puppet + DSC 13 Nano Server Image Builder https://goo.gl/IEFU9d
  • 14. Nano Server: Puppet + DSC 14 Server Feature Packages
  • 15. Nano Server: Puppet + DSC 15 Configuration SimpleVM { param ( [string[]]$NodeName = 'localhost', [string]$VhdPath ) Import-DscResource -ModuleName xHyper-V Node $NodeName { xVMSwitch internal { Ensure = 'Present' Name = 'internal' Type = 'Internal' } xVMHyperV SimpleVM { Ensure = 'Present' Name = 'SimpleVM' VhdPath = $VhdPath SwitchName = 'internal' State = 'Running' Generation = 1 StartupMemory = 512MB ProcessorCount = 1 DependsOn = '[xVMSwitch]internal' } } } SimpleVM -VhdPath 'C:/VM/NanoServerDataCenter.vhd' Desired State Configuration (DSC)
  • 16. Nano Server: Puppet + DSC 16 puppetlabs-dsc dsc_xVMHyperV { 'SimpleVM': dsc_ensure => present, dsc_name => 'SimpleVM', dsc_vhdpath => 'C:/VM/ NanoServerDataCenter.vhd', dsc_switchname => 'internal', dsc_state => 'running', dsc_generation => 1, dsc_startupmemory => 536870912, dsc_processorcount => 1, require => Dsc_XVMSwitch['internal'], } dsc_xVMSwitch { 'internal': dsc_ensure => 'present', dsc_name => 'internal', dsc_type => 'Internal', }
  • 17. Nano Server: Puppet + DSC 17 Demos GitHub:MikaelSmith/puppetconf2016
  • 18. Nano Server: Puppet + DSC 18 Hyper-V Demo https://github.com/MikaelSmith/puppetconf2016#hyper-v-demo
  • 19. Nano Server: Puppet + DSC 19 Hacks upon Hacks https://github.com/PowerShell/xStorage/pull/60 https://tickets.puppetlabs.com/browse/MODULES-3690 https://tickets.puppetlabs.com/browse/MODULES-3831 Everything’s broken … but getting fixed.
  • 20. Nano Server: Puppet + DSC 20 Vagrant/Virtualbox Enable-PSRemoting -Force Set-Item wsman:localhostclienttrustedhosts -Value localhost -Force $pw = ConvertTo-SecureString -asPlainText -Force "vagrant" $c = New-Object System.Management.Automation.PSCredential("vagrant", $pw) Enter-PSSession -ComputerName localhost -Port 55985 -Credential $c Vagrant Boxes: https://goo.gl/RSGdHN PowerShell Remoting rwinrm vagrant@127.0.0.1:55985 https://github.com/WinRb/WinRM Demo: https://github.com/MikaelSmith/puppetconf2016#build-vagrant-box
  • 21. Nano Server: Puppet + DSC 21 Vagrant Demo
  • 22. Nano Server: Puppet + DSC 22 Docker https://goo.gl/Vp5CQB Source: http://windowsitpro.com/windows-server-2016/differences-between-windows-containers-and-hyper-v-containers-windows-server-201
  • 23. Nano Server: Puppet + DSC FROM microsoft/nanoserver SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] ENV NPM_CONFIG_LOGLEVEL info ENV NODE_VERSION 4.6.1 ENV NODE_SHA256 f576f2dacc4262202ae21f7d64ab9a01b7e551795848dfa39ef39a2cd63fa42c RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; [System.IO.Compression.ZipFile]::ExtractToDirectory('C:node.zip', 'C:') ; Rename-Item -Path $('C:node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:nodejs' ; New-Item $($env:APPDATA + 'npm') ; $env:PATH = 'C:nodejs;{0}npm;{1}' -f $env:APPDATA, $env:PATH ; Set-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlSession ManagerEnvironment' -Name Path -Value $env:PATH ; Remove-Item -Path node.zip CMD [ "node.exe" ] 23 Dockerfiles https://goo.gl/kcTctx Source: https://github.com/StefanScherer/dockerfiles-windows/blob/e7a938a9e32fe89e6d5aa232054971ad91e98ac7/node/4.6/nano/Dockerfile Base Node Container
  • 24. Nano Server: Puppet + DSC 24 FROM node:4.6.1-nano
 
 RUN mkdir app 
 WORKDIR /app
 
 ONBUILD COPY package.json package.json 
 ONBUILD RUN npm install 
 ONBUILD COPY . .
 
 CMD [ "npm.cmd", "start" ] Dockerfiles, Cont. Source: https://github.com/StefanScherer/dockerfiles-windows/blob/e7a938a9e32fe89e6d5aa232054971ad91e98ac7/node/4.6/nano/onbuild/Dockerfile FROM nano:4.6.1-nano-onbuild Node Onbuild Template Application Builder
  • 25. Nano Server: Puppet + DSC 25 Docker Demo https://github.com/MikaelSmith/puppetconf2016#docker-demo
  • 26. Nano Server: Puppet + DSC https://github.com/MikaelSmith/puppet-agent/tree/nano-hacks https://github.com/MikaelSmith/puppetconf2016#docker-demo Track 5: Modern Infrastructure Running Puppet Software in Docker Containers - Gareth Rushgrove Kubernetes: Add Windows Containers Support https://github.com/kubernetes/kubernetes/issues/22623 26 Containers
  • 27. Nano Server: Puppet + DSC 27 Adding Puppet
  • 28. Nano Server: Puppet + DSC 28 Things that work Core Resources file, host, exec Modules - puppetlabs-reboot - Puppetlabs-acl Maybe - puppetlabs-powershell (after MODULES-3690, 3990) - puppetlabs-dsc (after MODULES-3831)
  • 29. Nano Server: Puppet + DSC 29 Registry + DSC dsc_registry { 'enable long paths': dsc_ensure => present, dsc_key => 'HKEY_LOCAL_MACHINESystemCurrentControlSetPolicies', dsc_valuename => 'LongPathsEnabled', dsc_valuedata => '1', Dsc_valuetype => 'DWORD', } Source: http://winaero.com/blog/how-to-enable-ntfs-long-paths-in-windows-10/
  • 30. Nano Server: Puppet + DSC Core Resources - user (requires ADSI) - group (requires ADSI) - package (no appx support yet) - scheduled_task (requires mstask.dll) Modules - puppet-iis (based on PowerShell WebAdministration) - many others 30 Things that don’t (yet)
  • 31. Nano Server: Puppet + DSC 31 $username = 'vagrant' $password = 'vagrant' $groupname = 'puppet' Users & Groups exec { 'puppet group': command => "New-LocalGroup -Name ${groupname}", unless => "Get-LocalGroup -Name ${groupname}", provider => powershell, }
  • 32. Nano Server: Puppet + DSC 32 exec { 'vagrant user in puppet group': command => "Add-LocalGroupMember -Group ${groupname} -Member ${username}", unless => "Get-LocalGroupMember -Group ${groupname} -Member ${username}", provider => powershell, require => [Exec['puppet group'], Exec['vagrant user']], } Users & Groups, Cont. exec { 'vagrant user': command => "New-LocalUser -Name ${username} -Password (ConvertTo-SecureString -AsPlainText "${password}" -Force)", unless => "Get-LocalUser -Name ${username}", provider => powershell, }
  • 33. Nano Server: Puppet + DSC 33 Puppet Demo https://github.com/MikaelSmith/puppetconf2016#puppet-demo
  • 34. Nano Server: Puppet + DSC 34 Packaging https://github.com/mikaelsmith/puppetconf2016#packaging-demo
  • 35. Nano Server: Puppet + DSC 35 Debugging Problems https://github.com/mikaelsmith/puppetconf2016#debugging-problems-demo
  • 36. Nano Server: Puppet + DSC Ways to get started Hyper-V directly, Docker, Virtualbox/Vagrant Tools to improve PowerShell, DSC modules, Puppet modules, Puppet core resources, applications, Vagrant, Packer, etc. 36
  • 37. Nano Server: Puppet + DSC 37 http://www.hurryupandwait.io/ https://cloudbase.it/
  • 38. Nano Server: Puppet + DSC 38 Thanks! Questions?