Skip to content

Instantly share code, notes, and snippets.

@dfetterman
dfetterman / gist:6d29da0e95f7009d0eae84f874345e09
Created June 10, 2019 18:11
Ansible Example vmware_guest provision without network
- name: "Ensure that virtual machine exists in VMC SDDC"
vmware_guest:
datacenter: "SDDC-Datacenter"
hostname: "{{ vsphere_server }}"
username: "{{ vsphere_user }}"
password: "{{ vsphere_password }}"
validate_certs: no
folder: "/SDDC-Datacenter/vm/Workloads"
name: "ansible-test-rhel-Demo1"
annotation: "This is a test VM created by Ansible"
@dfetterman
dfetterman / fizzbuzz.py
Created June 11, 2019 12:52
Dane Fetterman's version of FizzBuzz
for x in range(1, 101):
if (x % 5 == 0) and (x % 3 == 0):
print('FizzBuzz')
elif x % 5 == 0: #means x is exactly divisible by 5, therefor it is a multiple of 5
print('Buzz')
elif x % 3 == 0:
print('Fizz')
else:
print(x)
@dfetterman
dfetterman / mydata.json
Created June 11, 2019 15:27
Parse s3 json object
[
{
"clientName": "BobSmith",
"clientID": "22oi5qjafaflklkjklajlf",
"postconf": "CanvasCatalog",
"group": "MRH3"
},
{
"clientName": "ToddHarris",
"clientID": "i5qj3klq23rhljkna.nmaf",
@dfetterman
dfetterman / serverless.yml
Last active September 13, 2019 16:10
guarddutysignup example serverless.yml
service: guarddutysignup
custom:
stage: ${opt:stage, self:provider.stage}
memberRoleName: CrossAccountManageGuardDutyRole #The name of the role that will be assumed in member accounts
provider:
name: aws
runtime: python3.6
stage: dev #default stage
@dfetterman
dfetterman / gist:fcd8724e3353566b9105fc68b1142d8c
Created September 13, 2019 16:23
guarddutysignup - Example Serverless Service Information
Service Information
service: guarddutysignup
stage: dev
region: us-east-1
stack: guarddutysignup-dev
resources: 36
api keys:
mykey6: OGyJrKhQHUHNOWAYNOTSHARINGITdEpUc
endpoints:
functions:
@dfetterman
dfetterman / AssumeRole.py
Last active May 2, 2022 15:00
Python Assume Role Example
import boto3
awsaccntid = '123456789123'
targetrole = 'LISTCERTSSTSROLE'
## GET CREDENTIALS
def fn_assume_role(awsaccntid, targetrole):
client = boto3.client('sts')
response = client.assume_role(
RoleArn="arn:aws:iam::" + awsaccntid + ":role/" + targetrole,