Skip to content

Instantly share code, notes, and snippets.

Jon "The Nice Guy" Spriggs JonTheNiceGuy

View GitHub Profile
View AA_Mapping between FGT TZ and TZ_DB.md

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 Feb 21, 2019
Manipulating yaml tree data using Ansible
View AA_Manipulating yaml tree data using Ansible.md

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 Apr 10, 2019
A simple ansible playbook to create a new self-signed certificate
View create_cert.yml
---
- 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 Jul 27, 2018
This script is a simple script to redirect you from your site to other locations. It's a very basic short-link generator.
View AAA_Redirector_README.md

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 Jun 27, 2018
A "simple" shared-hosting Ansible setup for Cachet
View AAA_Cachet_on_Docker_with_Ansible.md

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 Jun 26, 2018
The following scripts are tools I use on a regular basis to run simple activities on the K5 platform.
View AA_K5_Simple_Scripts.md

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 Dec 5, 2017
Start a Google MusicManager session in another account
View gmm.sh
#!/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
@JonTheNiceGuy
JonTheNiceGuy / AAA_runas-README.md
Last active Dec 5, 2017
Run GUI commands as other users, without having to SSH to that user account.
View AAA_runas-README.md

runas for Unix-like Systems

Download these two files, and place them in /usr/local/bin. Chmod them to 755, and chown them to root:root.

Then, perform the following command:

runas -u someuser command

or

@JonTheNiceGuy
JonTheNiceGuy / User commands.yml
Created May 16, 2017
Some common "create user" commands for Ansible
View User commands.yml
- name: Create Users on W2012 Server
raw: if (dsquery user -samid "{{item.key}}") {"Not Required"} else { New-ADUser -SamAccountName "{{item.key}}" -UserPrincipalName "{{item.key}}@{{windows_domain}}" -Name "{{item.value.name}}" -DisplayName "{{item.value.name}}" -GivenName "{{item.value.name.split(" ")[1]}}" -Surname "{{item.value.name.split(" ")[-1]}}" -ChangePasswordAtLogon $true -Enabled $true -AccountPassword (ConvertTo-SecureString "{{default_password}}" -AsPlainText -Force) }
- name: Create Users on W2008 Server with Domain Admin
raw: if (dsquery user -samid "{{item.key}}") {"Not Required"} else {dsadd user "CN={{item.key}},CN=Users,{{search_base}}" -samid "{{item.key}}" -upn "{{item.key}}@{{windows_domain}}" -display "{{item.value.name|default("Undefined")}} {{item.value.role|default("")}}" -fn "{{item.value.name.split(" ")[1]|default("Undefined")}}" -ln "{{item.value.name.split(" ")[-1]|default("Undefined")}}" -mustchpwd yes -pwd "{{default_password}}" -memberof "CN=Domain Admins,CN=Users,{{s
View AAA_Readme_upgrade-tt-rss.md
You can’t perform that action at this time.