Skip to content

Instantly share code, notes, and snippets.

View jonathanmedd's full-sized avatar

Jonathan Medd jonathanmedd

View GitHub Profile
@jonathanmedd
jonathanmedd / compute_resource.json
Created October 22, 2019 14:12
compute_resource.json
{
"totalCount": 1,
"documentLinks": [
"/resources/compute/2fc3b93fb41c4d2a9e90def3de9b7"
],
"documentCount": 1,
"queryTimeMicros": 1000,
"documentVersion": 0,
"documentUpdateTimeMicros": 0,
"documentExpirationTimeMicros": 0,
@jonathanmedd
jonathanmedd / create_onboarding_resource.json
Created October 22, 2019 13:33
create_onboarding_resource.json
{
"documentLinks": [
"/relocation/onboarding/resource/aff80590-b5c5-4c72-8dcd-34db8e789ea3"
],
"documents": {
"/relocation/onboarding/resource/aff80590-b5c5-4c72-8dcd-34db8e789ea3": {
"planLink": "/relocation/onboarding/plan/afa87b23bf71470f91d9eecd46358",
"resourceLink": "/resources/compute/805c89e91c824734b1d47fb9da8bb",
"deploymentLink": "/relocation/onboarding/deployment/7bbdae56d4e5477eb28c40803d1a3",
"resourceName": "TEST001",
@jonathanmedd
jonathanmedd / _5_log-output.yml
Created October 18, 2019 15:04
_5_log-output.yml
---
- hosts: all
tasks:
- name: Copy a single file
win_copy:
src: "{{ playbook_dir }}/files/test-output.ps1"
dest: C:\Temp\test-output.ps1
- name: Run a script
@jonathanmedd
jonathanmedd / Example-ErrorHandling.ps1
Last active October 10, 2019 16:30
Example-ErrorHandling.ps1
#Requires -RunAsAdministrator
$ErrorActionPreference ='Stop'
# Get a service which doesn't exist
try {
Get-Service "This will fail"
}
catch {
Write-Error "Unable find service" -ErrorAction Continue
@jonathanmedd
jonathanmedd / _4_example-errorhandling.yml
Created October 10, 2019 15:58
_4_example-errorhandling.yml
---
- hosts: all
tasks:
- name: Copy a single file
win_copy:
src: "{{ playbook_dir }}/files/Example-ErrorHandling.ps1"
dest: C:\Temp\Example-ErrorHandling.ps1
- name: Run a script
@jonathanmedd
jonathanmedd / _3_invoke-powershell.ps1
Created October 2, 2019 16:19
_3_invoke-powershell.ps1
Set-Content -Path C:\Temp\test3.txt -Value "That's so wizard Ani"
@jonathanmedd
jonathanmedd / _3_invoke-powershell_c.yml
Created October 2, 2019 16:16
_3_invoke-powershell_c.yml
- name: Copy a single file
win_copy:
src: "{{ playbook_dir }}/files/test.ps1"
dest: C:\Temp\test.ps1
- name: Run a script
win_shell: C:\temp\test.ps1
@jonathanmedd
jonathanmedd / _3_invoke-powershell_b.yml
Created October 2, 2019 16:11
_3_invoke-powershell_b.yml
- name: Run multi-lined shell commands
win_shell: |
$text = Get-Content C:\Temp\test.txt
$text += ' General Kenobi....you are a bold one'
Set-Content -Path C:\Temp\test2.txt -Value $text
@jonathanmedd
jonathanmedd / _3_invoke-powershell_a.yml
Created October 2, 2019 16:06
_3_invoke-powershell_a.yml
- name: Single line PowerShell
win_shell: Set-Content -Path C:\temp\test.txt -Value 'Hello there. '
@jonathanmedd
jonathanmedd / _3_invoke-powershell.yml
Created October 2, 2019 15:55
_3_invoke-powershell.yml
---
- hosts: all
tasks:
- name: Single line PowerShell
win_shell: Set-Content -Path C:\temp\test.txt -Value 'Hello there. '
- name: Run multi-lined shell commands
win_shell: |
$text = Get-Content C:\Temp\test.txt