Skip to content

Instantly share code, notes, and snippets.

View luckylittle's full-sized avatar
:octocat:
Working for @RedHatOfficial

Lucian Maly luckylittle

:octocat:
Working for @RedHatOfficial
View GitHub Profile
@luckylittle
luckylittle / generate_md5sum.sh
Last active November 28, 2021 07:22
Create MD5 checksum for every MKV file
#!/bin/bash
find . -type f -iname "*.mkv" -execdir sh -c 'md5sum {} > $(basename {} .mkv).md5' \;
@luckylittle
luckylittle / sumologic.yml
Created May 21, 2020 01:16
Red Hat Ansible Tower - passing Sumologic accessID/accessKEY from the Microsoft Azure Key Vault to the playbook example
---
# Tested on Ansible 2.9.4 & Tower 3.6.4
# Passing Sumologic accessID/accessKEY from the Microsoft Azure Key Vault to the playbook example
# Copyright (c) 2020 Lucian Maly, Red Hat
# Configuration in Tower:
# 1) Credentials > prod-ansible-azure-kms:
# a/ VAULT URL (DNS NAME)
# b/ CLIENT ID
@luckylittle
luckylittle / s3_keys.yml
Created May 19, 2020 16:30
Red Hat Ansible aws_s3 module filter example
---
# Tested on Ansible 2.9.4
# aws_s3 module lists all objects, including folders - that is sometimes undesirable
# Copyright (c) 2020 Lucian Maly, Red Hat
- hosts: localhost
gather_facts: false
vars:
s3_keys:
@luckylittle
luckylittle / fqdn.yml
Last active May 16, 2020 23:58
Red Hat Ansible - Assign a FQDN of Windows machine based on the existence of hostname.properties
---
# Tested on Ansible 2.9.4
# Assign a FQDN of Windows machine based on the existence of hostname.properties
# Copyright (c) 2020 Lucian Maly, Red Hat
- name: 1.0 | FAILOVER_PORTAL | Find out if the 'hostname.properties' file exists.
win_stat:
path: 'C:\Program Files\PRODUCT\FOLDER1\FOLDER2\etc\hostname.properties'
register: hostname_stat
@luckylittle
luckylittle / 01-pb.run_tasks.yml
Created May 13, 2020 23:29
Red Hat Ansible Tower - passing vars from one playbook to another in the workflow
---
- name: 01 | Run Normal Tasks
hosts: all
gather_facts: no
vars:
ansible_connection: local
tasks:
- debug: var=vars
- name: 01.1 | FACT >> Set Status
@luckylittle
luckylittle / playbook-backup_ami_role.yml
Last active May 16, 2020 23:57
Red Hat Ansible - Creation and cleanup of AWS AMIs
---
# Tested on Ansible 2.9.4
# ansible-playbook -i localhost, -e "ami_backup_ec2_name=sandbox-dev-b" -e "ami_backup_count=3" -e "ami_backup_remove=yes" -e "ami_backup_ec2_region=ap-southeast-2" playbook-backup_ami_role.yml
# Copyright (c) 2020 Lucian Maly, Red Hat
- name: 1.0 | BACKUP_AMI | Gathering information about the instance {{ ami_backup_ec2_name }}.
ec2_instance_info:
filters:
"tag:Name": "{{ ami_backup_ec2_name }}"
@luckylittle
luckylittle / check_release_consistency.sh
Created May 8, 2020 04:34
Oneliner lists generic release folders which don't have the right amount of *.nfo and/or *.rar and/or *.sfv files in them
for x in `ls -1` ; do cd ${x}; echo ${x}\: NFOS=$(ls *.nfo | wc -l) RARS=$(ls *.rar | wc -l) SFVS=$(ls *.sfv | wc -l) ; cd .. ; done | grep -v 'NFOS=1 RARS=1 SFVS=1'
@luckylittle
luckylittle / check_ebooks.sh
Created May 8, 2020 04:11
Oneliner lists eBook release folders which don't have the right amount of *.nfo and/or *.diz files in them
for x in `ls -1` ; do cd ${x}; echo ${x}\: NFOS=$(ls *.nfo | wc -l) DIZS=$(ls *.diz | wc -l) ; cd .. ; done | grep -v 'NFOS=1 DIZS=1'
@luckylittle
luckylittle / hosts.ini
Created April 28, 2020 05:44
An example of Red Hat Ansible inventory in the YAML format
[localhost]
localhost ansible_connection = local
[datastore]
10.20.30.40 # Datastore
[portal]
10.20.30.50 # Portal
[server]
@luckylittle
luckylittle / fix_dblcmd_libunrar.sh
Last active June 20, 2024 03:59
Double Commander v0.9.6 fix for error "Cannot load library libunrar.so! Please check your installation."
#!/bin/bash
# > This is fix for "Cannot load library libunrar.so! Please check your installation."
# > doublecmd-gtk-0.9.6-1.2.x86_64 was installed with Alexx2000 repository:
# > http://download.opensuse.org/repositories/home:/Alexx2000/CentOS_7/x86_64/
wget http://www.rarlab.com/rar/unrarsrc-5.9.2.tar.gz
tar xvzf unrarsrc-5.9.2.tar.gz
cd unrar
make -f makefile lib