Skip to content

Instantly share code, notes, and snippets.

View mrlesmithjr's full-sized avatar

Larry Smith Jr. mrlesmithjr

View GitHub Profile
#!/usr/bin/env python
import os
import subprocess
from git import Repo
working_dir = os.getcwd()
repo = Repo(working_dir)
origin_branches = list()
{
"info": {
"_postman_id": "0d319df0-e132-4187-82f7-5e42d4e5335d",
"name": "TOWER",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Get Tasks",
"request": {
@mrlesmithjr
mrlesmithjr / get_ip.py
Created July 28, 2019 04:34
Ansible IP request loops mockup
#!/usr/bin/python
from random import getrandbits
from ipaddress import IPv4Network, IPv4Address
from ansible.module_utils.basic import AnsibleModule
def main():
fields = {'subnet': {'required': True, 'type': 'str'}}
module = AnsibleModule(argument_spec=fields)
#!/usr/bin/env python
# flush_dns.py
'''A handy script to flush dns cache for Linux/macOS/Windows.'''
import logging
from subprocess import Popen
from sys import platform
import psutil
---
- hosts: localhost
gather_facts: true
connection: local
# user: ansible
# become: true
vars:
# Define path to file to check
# file_to_check: /etc/ansible/ansible.cfg
# file_to_check: $HOME/ansible.cfg
### Keybase proof
I hereby claim:
* I am mrlesmithjr on github.
* I am mrlesmithjr (https://keybase.io/mrlesmithjr) on keybase.
* I have a public key ASDZkpNIa6LhHlP9uBTN7GG2FYQUIM0l0SCD5wtHGjw4ywo
To claim this, I am signing this object:
#adduser --shell /bin/bash --gecos "" --disabled-password testuser1
useradd -s /bin/bash -m -G sudo testuser1
echo "testuser1:testpass" | chpasswd
@mrlesmithjr
mrlesmithjr / ubuntu-live.json
Created April 4, 2019 04:57
Packer Ubuntu live cd
{
"variables": {
"boot_command_prefix": "",
"box_tag": "",
"compression_level": "6",
"iso_checksum": "",
"iso_checksum_type": "",
"iso_url": "",
"vagrant_cloud_token": "",
"vagrant_cloud_username": "",
@mrlesmithjr
mrlesmithjr / windows_runonce
Last active March 15, 2019 04:58
Windows runonce for Ansible
powershell.exe -Command "& {[Net.ServicePointManager]::SecurityProtocol = 'tls12'; Invoke-WebRequest -Uri https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 -OutFile C:\Windows\Temp\ConfigureRemotingForAnsible.ps1}"
powershell.exe -ExecutionPolicy Unrestricted -File C:\Windows\Temp\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert -EnableCredSSP
#!/usr/bin/env python
import json
VMS = {
'db01': {
'profile': 'Linux_DB',
'vm_size': 'medium'
},
'web01': {
'profile': 'Linux_Web',