Skip to content

Instantly share code, notes, and snippets.

Avatar

Larry Smith Jr. mrlesmithjr

View GitHub Profile
@mrlesmithjr
mrlesmithjr / ansible-macos-homebrew-packages.yml
Last active Oct 25, 2021
Install MacOS Homebrew Packages With Ansible
View ansible-macos-homebrew-packages.yml
---
- name: Install MacOS Packages
hosts: localhost
become: false
vars:
brew_cask_packages:
- atom
- docker
- dropbox
- firefox
View logstash_iis.yml
# Microsoft IIS logging....Use NXLOG for client side logging
filter {
if [type] == "iis" {
if [message] =~ "^#" {
drop {}
}
grok {
match => [
"message", "%{TIMESTAMP_ISO8601:logtime} %{IPORHOST:hostname} %{URIPROTO:cs_method} %{URIPATH:cs_stem} (?:%{NOTSPACE:cs_query}|-) %{NUMBER:src_port} %{NOTSPACE:cs_username} %{IP:clientip} %{NOTSPACE:cs_useragent} %{NUMBER:sc_status} %{NUMBER:sc_subresponse} %{NUMBER:sc_win32_status} %{NUMBER:timetaken}",
"message", "%{TIMESTAMP_ISO8601:logtime} %{IPORHOST:hostname} %{URIPROTO:cs_method} %{URIPATH:cs_stem} (?:%{NOTSPACE:cs_query}|-) %{NUMBER:src_port} %{NOTSPACE:cs_username} %{IP:clientip} %{NOTSPACE:cs_useragent} %{NOTSPACE:cs_referrer} %{NUMBER:sc_status} %{NUMBER:sc_subresponse} %{NUMBER:sc_win32_status} %{NUMBER:timetaken}"
View logstash_fw_grok.conf
filter {
grok {
match => [
"message", "<%{POSINT:syslog_pri}>%{CISCOTIMESTAMP:timestamp} %{SYSLOGHOST:sysloghost} %{NUMBER:log_sequence#}: %{CISCOTIMESTAMP:log_date}: %%{CISCO_REASON:facility}-%{INT:severity_level}-%{CISCO_REASON:facility_mnemonic}: %{GREEDYDATA:cisco_message}"
]
}
syslog_pri { }
grok {
match => [
"cisco_message", "(%{IP:src_ip}).*%{IP:dst_ip}"
View logstash_device_filtering.conf
filter {
if [type] == "syslog" {
dns {
reverse => [ "host" ]
action => "replace"
}
}
if "ESXi" in [syslog_host_id] {
mutate {
add_tag => [ "ESXi" ]
View logstash_source_host_ip.conf
filter {
if ![source_host_ip] and "_grokparsefailure" not in [tags] {
mutate {
add_field => [ "source_host_ip", "%{host}" ]
}
dns {
resolve => [ "source_host_ip" ]
action => "replace"
}
if [source_host_ip] == "127.0.1.1" {
View ansible-container --debug
2017-05-27T14:35:33.304571 The default type is [container.config] caller_file=/Users/larry/python-virtualenvs/ansible-container-0.9.1/lib/python2.7/site-packages/container/config.py caller_func=_resolve_defaults caller_line=140 config=<class 'ruamel.yaml.comments.CommentedMap'> defaults=<type '_ordereddict.ordereddict'>
2017-05-27T14:35:33.305364 Getting environment variables... [container.config] caller_file=/Users/larry/python-virtualenvs/ansible-container-0.9.1/lib/python2.7/site-packages/container/config.py caller_func=_get_environment_variables caller_line=156
2017-05-27T14:35:33.306091 Read environment variables [container.config] caller_file=/Users/larry/python-virtualenvs/ansible-container-0.9.1/lib/python2.7/site-packages/container/config.py caller_func=_get_environment_variables caller_line=161 env_vars={}
2017-05-27T14:35:33.306749 Resolved template variables [container.config] caller_file=/Users/larry/python-virtualenvs/ansible-container-0.9.1/lib/python2.7/site-packages/containe
View ansible_install_docker_from_binary_source.yml
- hosts: test_nodes
vars:
_docker_version: 17.12.0
tasks:
- group:
name: docker
state: present
become: true
View haproxy.cfg
# Ansible managed
global
# Remote syslog servers
log 10.0.102.102:514 local0
#log-send-hostname
daemon
chroot /var/lib/haproxy
group haproxy
maxconn 40000
View terraform_to_ansible_inventory.py
#! /usr/bin/env python
"""Parses Terraform tfstate to generate Ansible inventory."""
import json
import os
import yaml
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
TERRAFORM_INVENTORY = []
TERRAFORM_ANSIBLE_INVENTORY = (
View windows-dev-workstation.ps1
# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
refreshenv