Skip to content

Commit

Permalink
(talk) Add talks by Josh King for Summit 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
Windos committed May 4, 2023
1 parent 2c610c5 commit c8c348a
Show file tree
Hide file tree
Showing 27 changed files with 1,909 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
- hosts: havok
gather_facts: true

tasks:
- name: 'Create Atrius VM'
import_tasks: tasks/build-vm.yml
vars:
win_password: '{{ hostvars.atrius.win_password }}'
local_ip_addr: '{{ hostvars.atrius.local_ip_addr }}'
local_ip_gateway: '{{ hostvars.atrius.local_ip_gateway }}'
friendly_hostname: '{{ hostvars.atrius.friendly_hostname }}'
hyperv_disk_size: '{{ hostvars.atrius.hyperv_disk_size }}'
hyperv_cpu: '{{ hostvars.atrius.hyperv_cpu }}'
hyperv_memory_min: '{{ hostvars.atrius.hyperv_memory_min }}'
hyperv_memory_max: '{{ hostvars.atrius.hyperv_memory_max }}'
hyperv_memory_start: '{{ hostvars.atrius.hyperv_memory_start }}'
hyperv_autostart: '{{ hostvars.atrius.hyperv_autostart }}'
hyperv_autostartdelay: '{{ hostvars.atrius.hyperv_autostartdelay }}'

- name: 'Create Bane VM'
import_tasks: tasks/build-vm.yml
vars:
win_password: '{{ hostvars.bane.win_password }}'
local_ip_addr: '{{ hostvars.bane.local_ip_addr }}'
local_ip_gateway: '{{ hostvars.bane.local_ip_gateway }}'
friendly_hostname: '{{ hostvars.bane.friendly_hostname }}'
hyperv_disk_size: '{{ hostvars.bane.hyperv_disk_size }}'
hyperv_cpu: '{{ hostvars.bane.hyperv_cpu }}'
hyperv_memory_min: '{{ hostvars.bane.hyperv_memory_min }}'
hyperv_memory_max: '{{ hostvars.bane.hyperv_memory_max }}'
hyperv_memory_start: '{{ hostvars.bane.hyperv_memory_start }}'
hyperv_autostart: '{{ hostvars.bane.hyperv_autostart }}'
hyperv_autostartdelay: '{{ hostvars.bane.hyperv_autostartdelay }}'

- hosts:
- atrius
- bane
gather_facts: false

tasks:
- wait_for_connection:
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
- hosts:
- atrius
- bane
gather_facts: true

tasks:
- name: Check if installation type is Server Core
ansible.windows.win_powershell:
script: |
$Ansible.Changed = $false
$InstallationType = Get-ItemProperty -Path "HKLM:/Software/Microsoft/Windows NT/CurrentVersion" | Select-Object -ExpandProperty "InstallationType"
$Ansible.Result = $InstallationType -eq 'Server Core'
register: _is_server_core

- name: Install NuGet provider
ansible.windows.win_powershell:
script: |
if (-not (Get-PackageProvider -ListAvailable | Where-Object Name -EQ 'NuGet')) {
$null = Install-PackageProvider NuGet -MinimumVersion 2.8.5.201 -Force -Scope AllUsers -ForceBootstrap
$Ansible.Changed = $true
} else {
$Ansible.Changed = $false
}
- name: Ensure Chocolatey CLI is installed
chocolatey.chocolatey.win_chocolatey:
name: 'chocolatey'
state: 'latest'

# - name: 'Add internal Chocolatey source'
# chocolatey.chocolatey.win_chocolatey_source:
# name: 'choco-proxy'
# state: present
# source: '{{ choco_repo }}'
# source_username: '{{ choco_user }}'
# source_password: '{{ choco_password }}'
# update_password: on_create
# no_log: true
#
# - name: 'Disable Chocolatey Community Repository source'
# chocolatey.chocolatey.win_chocolatey_source:
# name: chocolatey
# state: disabled

- name: Install baseline Chocolatey packages
chocolatey.chocolatey.win_chocolatey:
name: '{{ item.name | mandatory }}'
version: '{{ item.version | default(omit) }}'
state: '{{ "latest" if item.version is undefined else "downgrade" }}'
package_params: '{{ item.package_params | default(omit) }}'
loop: '{{ baseline_packages }}'
register: choco_install
until: choco_install is not failed
retries: 3

- name: Install and Configure BackInfo
block:
- name: 'Create BackInfo directory structure'
ansible.windows.win_file:
path: C:\Tools\BackInfo
state: directory

- name: 'Ensure the BackInfo executable is in the correct location'
win_copy:
src: 'BackInfo.exe'
dest: 'C:\Tools\BackInfo\BackInfo.exe'

- name: 'Ensure the Server 2019 wallpaper is in the correct location'
win_copy:
src: 'Srv2019.bmp'
dest: 'C:\Tools\BackInfo\Srv2019.bmp'

- name: 'Ensure BackInfo configuration'
win_template:
src: "BackInfo.ini.j2"
dest: 'C:\Tools\BackInfo\BackInfo.ini'

- name: 'Create a shortcut to BackInfo.exe in the Startup directory'
community.windows.win_shortcut:
src: 'C:\Tools\BackInfo\BackInfo.exe'
dest: '%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Startup\BackInfo.lnk'
when: backinfo_description is defined and not _is_server_core.result
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
- hosts:
- atrius
- bane
gather_facts: true
strategy: free
# serial: 2

tasks:
- name: Install IIS feature and management tools
ansible.windows.win_feature:
name: Web-Server
state: present
include_sub_features: yes
include_management_tools: yes
register: iis_feature

- name: Reboot if installing IIS feature requires it
ansible.windows.win_reboot:
when: iis_feature.reboot_required

# https://www.free-css.com/free-css-templates/page200/biwas
- name: 'Copy website code bundle'
win_copy:
src: 'BiwasWebsite.zip'
dest: 'C:\Tools\BiwasWebsite.zip'

- name: Unzip website code bundle
community.windows.win_unzip:
src: C:\Tools\BiwasWebsite.zip
dest: C:\Tools\
creates: C:\Tools\bs-biwas

- name: 'Patch website stylesheet'
win_template:
src: 'style.css.j2'
dest: 'C:\Tools\bs-biwas\assets\css\style.css'

- name: Remove Default Web Site
community.windows.win_iis_website:
name: "Default Web Site"
state: absent

- name: Create Summit Demo Site
community.windows.win_iis_website:
name: Summit Demo
state: started
port: 80
ip: '*'
physical_path: C:\Tools\bs-biwas
register: iis_website

- name: Restart IIS
ansible.windows.win_powershell:
script: iisreset
when: iis_website.changed
...
Loading

0 comments on commit c8c348a

Please sign in to comment.