Skip to content

Instantly share code, notes, and snippets.

View apolloclark's full-sized avatar
💭
automating the world

Apollo Clark apolloclark

💭
automating the world
View GitHub Profile
pre_tasks:
  - name: debug
    debug:
      msg: "{{ ansible_distribution }}-{{ ansible_distribution_release }}-{{ ansible_distribution_major_version }}-{{ ansible_distribution_version }}.yml"


{{ ansible_distribution }}
{{ ansible_distribution_release }}
{{ ansible_distribution_major_version }}
@apolloclark
apolloclark / jenkins credentials-plugin example.md
Created January 31, 2019 17:07
Jenkins credentials-plugin example script
# run jenkins/jenkins:lts, with volumes, exposed ports
docker run -d -v jenkins_home:/var/jenkins_home \
  -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
  
# Jenkins Pipeline script, using Credentials

pipeline {
    agent any
@apolloclark
apolloclark / kubernetes cheatsheet.md
Last active January 15, 2019 17:14
kubernetes cheatsheet

Approach

  1. Inventory Management
  2. Access Management
  3. Configuration Management
  4. Patch Management
  5. Logging and Monitoring
  6. Alerts
  7. Automated Remediation
  • Keep it simple
@apolloclark
apolloclark / update_aws_ipv4.sh
Last active November 30, 2020 19:19
Dynamically update an AWS Route53 sub-domain IP address to your home router IP
[change-resource-record-set.json]
{
"Comment": "Updating IP address",
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "domain.example.com",
"Type": "A",
"TTL": 60,
@apolloclark
apolloclark / rhel cheat sheet.md
Last active May 9, 2022 01:48
Redhat LInux cheat sheet
@apolloclark
apolloclark / lock_down_public_s3_buckets.md
Last active January 27, 2023 08:10
Bash one-liner to find public facing AWS S3 buckets, and make them private

Command

aws s3api list-buckets --query 'Buckets[*].[Name]' --output text | xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} --query '"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers` && Permission==`READ`]'"'"' --output text) ]]; then aws s3api put-bucket-acl --acl "private" --bucket {} ; fi'



1. List all of the user's buckets, and output the name, as text.

@apolloclark
apolloclark / s3-buckets-public.sh
Last active October 8, 2019 05:46
check for public s3 buckets
aws s3api list-buckets --query 'Buckets[*].[Name]' --output text | xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} --query '"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers` && Permission==`READ`]'"'"' --output text) ]]; then echo {} ; fi'