Skip to content

Instantly share code, notes, and snippets.

View benformosa's full-sized avatar

Ben Formosa benformosa

View GitHub Profile
---
- name: Reproduce Docker Swarm Service issue
ignore_errors: true
run_once: true
hosts: all
tasks:
- name: Delete service
become: true
community.docker.docker_swarm_service:
@benformosa
benformosa / play_postgres_user.log
Last active June 27, 2022 05:20
Test idempotency of postgresql_user module with SCRAM password
2022-06-27 15:15:35,080 p=2312317 u=ben n=ansible | PLAY [Test idempotency of postgresql_user module with SCRAM password] ****************************************************************************************
2022-06-27 15:15:35,092 p=2312317 u=ben n=ansible | TASK [Gathering Facts] ***************************************************************************************************************************************
2022-06-27 15:15:36,959 p=2312317 u=ben n=ansible | ok: [localhost]
2022-06-27 15:15:36,978 p=2312317 u=ben n=ansible | TASK [Remove test users] *************************************************************************************************************************************
2022-06-27 15:15:37,596 p=2312317 u=ben n=ansible | ok: [localhost] => (item=clearpassword)
2022-06-27 15:15:38,003 p=2312317 u=ben n=ansible | ok: [localhost] => (item=scrampassword)
2022-06-27 15:15:38,014 p=2312317 u=ben n=ansible | TASK [Create users] *******************************************************************
@benformosa
benformosa / my_module.py
Created February 27, 2020 23:49
ansible shebang.py bug report
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
def main():
@benformosa
benformosa / myway.py
Created October 27, 2018 04:10
Check your Transport Canberra MyWay Card balance
#!/usr/bin/env python3
"""Check your Transport Canberra MyWay Card balance"""
from bs4 import BeautifulSoup
import argparse
import datetime
import getpass
import requests
@benformosa
benformosa / satellite_backup_estimate.sh
Last active November 12, 2020 07:25
Estimate the size of a Red Hat Satellite backup
#!/usr/bin/bash
set -o errexit # -e
set -o pipefail
# Estimate the size of a Red Hat Satellite backup
# Based on https://access.redhat.com/documentation/en-us/red_hat_satellite/6.3/html/administering_red_hat_satellite/chap-red_hat_satellite-administering_red_hat_satellite-backup_and_disaster_recovery#sect-Red_Hat_Satellite-Administering_Red_Hat_Satellite-Backing_up_Satellite_Server_or_Capsule_Server-Estimating_the_Size_of_a_Backup
# Author: Ben Formosa
# Copyright 2018, Commonwealth of Australia
@benformosa
benformosa / yaml-format.sh
Created April 3, 2017 00:00
Format all YAML files under current directory
#!/bin/bash
# Requires Perl YAML module (https://metacpan.org/release/YAML) and sponge from moreutils (https://joeyh.name/code/moreutils/)
# Debian: apt-get install libyaml-perl moreutils
find . -regex ".*\.ya*ml" -printf "perl -e 'use YAML::XS; local $/; print Dump Load <>;' < %p | sponge %p\n" | sh
python -c "import sys; import yaml; import pprint; print yaml.safe_dump(yaml.safe_load(sys.stdin))"