Skip to content

Instantly share code, notes, and snippets.

View JonTheNiceGuy's full-sized avatar

Jon "The Nice Guy" Spriggs JonTheNiceGuy

View GitHub Profile

Readme for apt upgrades with Ansible

Here are three separate ways of using Ansible to perform system upgrades on an Ubuntu based system.

  1. apt-update-upgrade.yml This is the absolute most basic playbook I use. It performs an apt update, then apt full-upgrade and lastly an apt autoremove and apt autoclean.
  2. apt-update-upgrade-only-once-a-day.yml I use this in playbook where I'm repeatedly running it to do installs or reconfiguration, or where I have unattended-upgrades installed.
  3. apt-update-upgrade-with-check.yml On systems where I'm not the only administrator, I don't always know whether I'll want to apply an upgrade, so this gives me a chance to list off what packages will be updated

Sanitized Outlook Event Forwarding

This is an example of what I use with my work calendar, when I need to forward something to my personal calendar.

This macro does not include any of the meeting content (who will be there, what the content is), but is just to block out the time to prevent your personal and professional lives from overlapping. This macro will create a new appointment for the time window, optionally including the subject (or replace it with [WORK]) and optionally including the location (or replace it with [WORK]).

After the invite has been sent, it deletes the invite, so it doesn't look like you've got two meetings at the same time.

@JonTheNiceGuy
JonTheNiceGuy / AAA_Readme for KPSync.md
Created April 25, 2019 22:35
Three-way sync on Keepass files, using Keepass2 and KPScript on a Linux based system.

This script is used if you want to do a three-way sync between (for example) Dropbox, Nextcloud and Syncthing (depending on your personal deployment capabilities).

It should be relatively easy to determine what tweaks are needed to reduce this to a 2-way sync, or up to a 4, 5 or even 6 way sync.

Mapping the FortiGate Timezone Field with the TZ Database

This yml file shows the relationship between the tz_database values for regions (e.g. Europe/London) and the Fortigate "system global timezone" value (e.g. 25 = Europe/London).

The TZ Database names are taken from a Wikipedia entry on TZ values, and the Fortigate values are found by me splitting the strings (on comma's) from when I have tried auto-completing the timezone field on a Fortigate model.

It is not a perfect list! Updates welcome!!

@JonTheNiceGuy
JonTheNiceGuy / AA_Manipulating yaml tree data using Ansible.md
Last active February 21, 2019 09:35
Manipulating yaml tree data using Ansible

Manipulating yaml tree data using Ansible

I sometimes need to convert from a dictionary tree (like in data.yml) to a specific json formatted output file using Ansible.

In this case, I've used a combination of set_fact, a for loop and a combine filter to build my output. I'm also using a regex_search to make sure I'm only getting records where the data I'm interested in is there!

Hope it's useful to people!

@JonTheNiceGuy
JonTheNiceGuy / create_cert.yml
Last active January 9, 2022 18:31
A simple ansible playbook to create a new self-signed certificate
---
- hosts: localhost
vars:
- dnsname: your.dns.name
- tmppath: "./tmp/"
- crtpath: "{{ tmppath }}{{ dnsname }}.crt"
- pempath: "{{ tmppath }}{{ dnsname }}.pem"
- csrpath: "{{ tmppath }}{{ dnsname }}.csr"
- pfxpath: "{{ tmppath }}{{ dnsname }}.pfx"
- private_key_password: "password"
@JonTheNiceGuy
JonTheNiceGuy / AAA_Redirector_README.md
Created July 27, 2018 08:24
This script is a simple script to redirect you from your site to other locations. It's a very basic short-link generator.

Redirector

This script is a simple script to redirect you from your site to other locations. It's a very basic short-link generator.

@JonTheNiceGuy
JonTheNiceGuy / AAA_Cachet_on_Docker_with_Ansible.md
Last active August 10, 2020 11:04
A "simple" shared-hosting Ansible setup for Cachet

Cachet on Docker with Ansible

This is not a "best-practice" example of doing any of these tasks. The nginx stuff could probably do with being moved into roles, and I could probably move the variables into a file handling that... however, as a POC, it works.

@JonTheNiceGuy
JonTheNiceGuy / AA_K5_Simple_Scripts.md
Last active June 26, 2018 08:56
The following scripts are tools I use on a regular basis to run simple activities on the K5 platform.

The following scripts are tools I use on a regular basis to run simple activities on the K5 platform. They can fairly easily be modified to work with OpenStack (and, probably in many cases, will work without modifications).

These are all written by me in my spare time, and are released under the WTFPL.

@JonTheNiceGuy
JonTheNiceGuy / gmm.sh
Created December 5, 2017 23:20
Start a Google MusicManager session in another account
#!/bin/bash
while ! ping -c 1 8.8.8.8 2>/dev/null >/dev/null ; do
echo Waiting for network...
done
ssh -X bloggsf@localhost -i ~/.ssh/gmm.id_rsa /opt/google/musicmanager/google-musicmanager