Skip to content

Instantly share code, notes, and snippets.

View larryclaman's full-sized avatar

Larry Claman larryclaman

View GitHub Profile
#cloud-config
package_upgrade: false
write_files:
- path: /etc/systemd/system/docker.service.d/docker.conf
content: |
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
- path: /etc/docker/daemon.json
content: |
apiVersion: v1
kind: Service
metadata:
name: api
spec:
selector:
app: api
ports:
- protocol: TCP
port: 3001
@larryclaman
larryclaman / example.tf
Created July 12, 2019 15:12
Terraform example
locals {
"winscript" = "powershell iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) ;powershell choco install --ignore-checksums -y microsoftazurestorageexplorer ;powershell choco install -y IIS-WebServer --source windowsfeatures ;powershell choco install webdeploy -y; choco install azure-cli -y; powershell exit 0"
}
resource "azurerm_virtual_machine_extension" "bootstrapwin" {
https://api.github.com/repos/MicrosoftDocs/azure-docs/commits?author=larryms
az group delete --name BCDRLabRG -y
az group delete --name BCDRIaaSPrimarySite -y
az group delete --name BCDRIaaSSecondarySite -y
az group delete --name BCDRAzureAutomation -y
az group delete --name BCDRAzureSiteRecovery -y
az group delete --name BCDROnPremPrimarySite -y
az group create --name BCDRLabRG --location CentralUS
az group create --name BCDRIaaSPrimarySite --location EastUS
az group create --name BCDRIaaSSecondarySite --location CentralUS
see https://help.ubuntu.com/community/KVM/Access
systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service
https://askubuntu.com/questions/841112/very-slow-boot-time-ubuntu-a-start-job-is-running-for-raise-network-interfaces
The easiest way to create this file is through systemctl itself:
$ sudo systemctl edit networking.service
in this file:
[Service]
TimeoutStartSec=30sec
@larryclaman
larryclaman / gist:5503dfb1cc53f85e0915b7b829bcb000
Created April 1, 2020 20:59
Azure Policy to enforce Tag & Pattern
{
"properties": {
"displayName": "Require a tag, value and pattern",
"policyType": "Custom",
"mode": "Indexed",
"description": "Enforces a required tag and its value. Does not apply to resource groups.",
"metadata": {
"category": "Tags",
"createdBy": "10742b83-5bcb-45ba-9a2b-8a953928fc04",
"createdOn": "2020-04-01T16:11:01.7403115Z",
@larryclaman
larryclaman / convert-to-spot.ps1
Created April 8, 2020 19:23
Convert an Azure VM to a Spot VM type
<# Convert a VM to a Spot VM
Based on sample script at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/change-availability-set
NOTE: Extensions will not be copied to new instance!!
#>
# Set variables to your specifics
$resourceGroup = "myRG"
$vmName = "myVM"
# Get the details of the VM to be moved to the Availability Set