Skip to content

Instantly share code, notes, and snippets.

View mpoore's full-sized avatar

Michael Poore mpoore

View GitHub Profile
@mpoore
mpoore / salt-minion.sh
Created April 24, 2024 09:05
Bash script to install the Salt Minion on a RHEL-based OS and enable a systemd timer
#!/bin/bash
# Configure salt-minion
# @author Michael Poore
## Adding salt repository
echo 'Adding salt repository ...'
major_version=$(echo $OS_VERSION | cut -d '.' -f 1)
echo "-- OS major version: $major_version"
rpm --import https://repo.saltproject.io/salt/py3/redhat/$major_version/x86_64/SALT-PROJECT-GPG-PUBKEY-2023.pub &>/dev/null
curl -fsSL https://repo.saltproject.io/salt/py3/redhat/$major_version/x86_64/latest.repo | tee /etc/yum.repos.d/salt.repo &>/dev/null
#cloud-config
# Upgrade the instance on first boot
# (ie run apt-get upgrade)
#
# Default: false
# Aliases: apt_upgrade
package_upgrade: true
@mpoore
mpoore / createDeploymentNameFromCatalogItemNameAndEnv.js
Created February 14, 2021 12:58
vRO action - createDeploymentNameFromCatalogItemNameAndEnv
/* ----------------------------------------------------------------------------
Name: createDeploymentNameFromCatalogItemNameAndEnv
Description: Creates a unique vRA deployment name based on the
Catalog Item name and a date/time
Author: Michael Poore (@mpoore)
URL: https://github.com/v12n-io/vro-repository
Date: 14/02/2021
Version: 0.0.1
Changes:
formatVersion: 1
inputs:
compute:
type: object
$ref: /ref/property-groups/compute-properties
resources:
Cloud_Machine_1:
type: Cloud.Machine
properties:
image: '${input.compute.image}'
@mpoore
mpoore / logPayloadProperties.js
Created May 26, 2020 16:49
vRO action that logs the content of a Properties object
System.log("==== Begin: vRA Event Broker Payload Properties ====");
logAllProperties(payload,0);
System.log("==== End: vRA Event Broker Payload Properties ====");
function logAllProperties(props,indent) {
var keys = (props.keys).sort();
for each (var key in keys) {
var prop = props.get(key);
var type = System.getObjectType(prop);
if (type == "Properties") {
@mpoore
mpoore / generate-new-hostname.js
Created May 26, 2020 16:18
Generate New Hostname - vRO Workflow
// Set variables
var result = attNameFormat;
var hostnameIdx = attIndexFormat;
var nextNum = 0;
var digitCount = attNameFormat.match(/(#)/g).length;
// Create request object
var requestObj = JSON.parse(request.toLowerCase());
// Create translations object
var translationsObj = JSON.parse(attTranslations.getContentAsMimeAttachment().content.toLowerCase());
@mpoore
mpoore / phase1-config.ps1
Created April 28, 2020 15:20
Phase 1 configuration script for Windows 2019 deployment using Packer
# Basic configuration of vanilla Windows Server installation to progress Packer.io builds
# @author Michael Poore
# @website https://blog.v12n.io
# @source https://github.com/virtualhobbit
$ErrorActionPreference = "Stop"
# Switch network connection to private mode
# Required for WinRM firewall rules
$profile = Get-NetConnectionProfile
Set-NetConnectionProfile -Name $profile.Name -NetworkCategory Private
@mpoore
mpoore / phase2-config.ps1
Created April 28, 2020 15:15
Phase 2 configuration script for Windows 2019 deployment using Packer
# Second-phase configuration of vanilla Windows Server installation to progress Packer.io builds
# @author Michael Poore
# @website https://blog.v12n.io
$ErrorActionPreference = "Stop"
# Variables
$certUrl = "http://<<PKI server>>/CertEnroll"
$certRoot = "Root-CA.crt"
$certIssuing = "uIssuing-CA.crt"
$repository = "http://<<artifactory>>:8082/artifactory/packer-local/windows/common/utils/BGinfo"