Skip to content

Instantly share code, notes, and snippets.

input {
http {
port => 8080
}
}
filter {
if [logger_name] == "awx.api.generics" {
if [message] =~ /[Uu]ser/ {
grok {
---
- hosts: all
gather_facts: no
become: yes
vars:
nginx_ssl_cert: "/etc/ssl/certs/nginx.crt"
nginx_ssl_key: "/etc/ssl/private/nginx.key"
nginx_ssl_csr: "/etc/ssl/csr/nginx.csr"
handlers:
- name: "Restart Nginx"
# Vagrant file for a three node Ceph cluster on VirtualBox
Vagrant.configure("2") do |config|
config.vm.define "node0" do |node0|
node0.vm.box = "centos/7"
node0.vm.hostname = 'node0'
node0.vm.network :private_network, ip: "192.168.54.100"
node0.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 512]
@bradynathan
bradynathan / dump_vars.yml
Created February 19, 2020 16:53
Dump all variables associated with an Ansible host
---
- hosts: localhost,all
gather_facts: yes
tasks:
- name: Dump all vars
copy:
dest: "/tmp/ansible.all"
content: |
Module Variables ("vars"):
--------------------------------
@bradynathan
bradynathan / delete_vbox_disks.sh
Created September 23, 2019 22:06
Delete orphaned vbox disk
vboxmanage list hdds | awk '{printf("%s,",$0)}'| sed -e $'s/,,/\\\n/g' | sed -e $'s/,/\ /g' |awk '/inaccessible/ {print $2}' | xargs -I vboxmanage closemedium disk {} --delete
@bradynathan
bradynathan / create_venv.sh
Created February 12, 2019 18:17
Build Ansible Venv
#!/bin/bash
# Requires the following yum packages:
# gcc
# python
# python-pip
# python-virtualenv
# krb5-devel
# openssl-devel
# libcurl-devel
# sshpass
@bradynathan
bradynathan / tower_job_launch.py
Created November 28, 2018 20:17
Sample Script to Launch Tower Jobs
#!/bin/python
# Sample Script to Launch Tower Jobs and Monitor progress.
# This script can leverage tower_cli.cfg for user, host, and password.
# Extra_vars and Job Template should be passed through the command line
# BEGIN Defaults
tower_polling_interval = 60
tower_job_extra_vars = '{}'
tower_certificate_verify = True
# END Defaults
@bradynathan
bradynathan / ansible_tower_notes.txt
Created February 1, 2018 18:37 — forked from tuxfight3r/ansible_tower_notes.txt
Update Ansible Tower licence via REST api
##GET TOKEN
#Query to retrieve token
curl -X POST -k -v \
-H 'Content-Type: application/json' \
--data @/tmp/cred.json \
https://tower.super.io/api/v1/authtoken/
#cat /tmp/cred.json
{ "username": "admin",
"password": "secretpass" }
@bradynathan
bradynathan / resize_JPG.sh
Last active February 1, 2018 18:35
Batch resize JPG files
# Convert is part of the ImageMagick package
yum install -y ImageMagick
# Loop through resizing every image
for i in *.JPG; do convert "$i" -resize 25% "${i%%.*}_reduced.jpg"; done
# Remove the full size files
rm -f *.JPG
---
- name: Use openssl to verify system rebooted
local_action: shell openssl s_client -connect {{ ansible_host }}:{{ ansible_port| default(22) }}
become: false
ignore_errors: True
register: openssl_test_result
changed_when: False
- name: Email notification if server is not reachable