Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python,...
Transcript of Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python,...
![Page 1: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/1.jpg)
10 Things I Hate About You:Manage Windows like Linux with Ansible
Matt DavisSenior Principal Software Engineer, Ansible CoreMay 9, 2018
![Page 2: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/2.jpg)
Who am I?
![Page 3: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/3.jpg)
I LOVE WINDOWS
![Page 4: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/4.jpg)
![Page 5: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/5.jpg)
Not SSH
● WinRM (HTTP-based remote shell protocol)● Non-interactive logon● Different connection plugin● Microsoft OpenSSH?
![Page 6: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/6.jpg)
DEMO: WinRM Connectivity
![Page 7: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/7.jpg)
Powershell
● Unlike Python, "just there" on modern Windows● We can use .NET● Powershell 3+, Windows 7/Server 2008+● Access to the DSC universe via win_dsc
![Page 8: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/8.jpg)
App Install/Maintenance
● win_chocolatey !● win_package● NOT win_msi
![Page 9: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/9.jpg)
DEMO: win_chocolatey module
![Page 10: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/10.jpg)
Reboots, oh the reboots...
● win_reboot action makes managed reboots trivial● wait_for_connection is just the second half
![Page 11: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/11.jpg)
Windows Update
● Basic, synchronous updates● Uses configured source (Windows Update/WSUS)● (new in 2.5): transparent SYSTEM + auto reboot
![Page 12: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/12.jpg)
- win_updates: category_names: CriticalUpdates reboot: yes # new in 2.5! blacklist: # new in 2.5! - KB4056892
Windows Update
![Page 13: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/13.jpg)
IIS
● Modules for managing websites, webapps, apppools, virtual dirs, etc.
![Page 14: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/14.jpg)
- win_iis_website: name: Default Web Site physical_path: C:\Inetpub\WWWRoot- win_iis_webapp: site: Default Web Site name: OrchardCMS physical_path: C:\Inetpub\WWWRoot\Orchard
IIS
![Page 15: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/15.jpg)
Registry
● Manage individual key/value (win_regedit)● Manage idempotent bulk import (win_regmerge)
![Page 16: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/16.jpg)
- win_regedit: path: HKLM\Software\Microsoft\Windows name: SomeValueName value: 0x12345
- win_regmerge: path: ComplexRegData.reg
Registry
![Page 17: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/17.jpg)
Services
● win_service looks/acts like Linux service module● Provides fine control over complex service
behavior config in Windows SCM (who/what/when/how)
![Page 18: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/18.jpg)
# ensure IIS is running- win_service: name: W3Svc state: running
# ensure firewall service is stopped/disabled- win_service: name: MpsSvc state: stopped start_mode: disabled
Services
![Page 19: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/19.jpg)
Domains
● Windows' way of doing enterprise identity● Makes auth complex● Ansible can do "throwaway" domains easily● Promote/depromote DCs● Joining/leaving domain is simple● Manage basic domain objects
![Page 20: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/20.jpg)
# create a domain- win_domain: dns_domain_name: mydomain.local safe_mode_password: ItsASecret
# add a domain user- win_domain_user: name: somebody upn: [email protected] groups:
- Domain Admins
Domains
![Page 21: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/21.jpg)
DEMO: Domain Join/Unjoin
![Page 22: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/22.jpg)
ACLs
● More granular than Linux permissions● SDDL?!● More like SELinux ACLs
![Page 23: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/23.jpg)
- win_owner: path: C:\Program Files\SomeApp user: Administrator recurse: true
- win_acl: path: C:\Temp user: Users rights: ReadAndExecute,Write,Delete inherit: ContainerInherit,ObjectInherit
ACLs
![Page 24: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/24.jpg)
Wrapup
![Page 25: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/25.jpg)
+ =
![Page 26: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/26.jpg)
Questions?
![Page 27: Manage Windows like Linux with Ansible 10 Things I Hate About …€¦ · Powershell Unlike Python, "just there" on modern Windows We can use .NET Powershell 3+, Windows 7/Server](https://reader033.fdocuments.in/reader033/viewer/2022042916/5f57d0278a7a022f94232458/html5/thumbnails/27.jpg)
plus.google.com/+RedHat
linkedin.com/company/red-hat
youtube.com/user/RedHatVideos
facebook.com/redhatinc
twitter.com/RedHat
THANK YOU