Skip to content

Instantly share code, notes, and snippets.

View wolftales's full-sized avatar

Ken Hillier wolftales

View GitHub Profile
@wolftales
wolftales / gist:bc46a4954fd3aa2448985c1c78d679f2
Created March 31, 2023 16:05
Ansible variable conditional behavior example: if-elif-else
Nested if-else statements that replicate the elif capability:
- name: set_fact based on varible
set_fact:
colour_fruit: "{{ 'green' if fruit == 'apples' else 'yellow' if fruit == 'bananas' else 'unknown' }}"
(A if True else B if True else C)
Can be nested further for additional elif's at the expense of readability
# GitHub Desktop for Linux
# Github Desktop for Ubuntu https://github.com/shiftkey/desktop/releases/latest
# Source: https://github.com/shiftkey/desktop
Debian/Ubuntu distributions
First install our GPG certificate:
wget -qO - https://mirror.mwt.me/ghd/gpgkey | sudo tee /etc/apt/trusted.gpg.d/shiftkey-desktop.asc > /dev/null
@wolftales
wolftales / main.py
Last active November 22, 2023 18:53 — forked from Everalda/main.py
Template main python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Example Title
Short description
Long description (Optional)
Requirements:
- asdf
Usage: ./example_title.py
"""
@wolftales
wolftales / comprehensive_header.py
Created February 3, 2023 02:28 — forked from NicolasBizzozzero/comprehensive_header.py
Python template of a comprehensive header, with shebang, docstring, GPLv3 license and all metadata.
#!/usr/bin/env python
""" Short description of this Python module.
Longer description of this module.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
@wolftales
wolftales / python_header_template.py
Last active February 3, 2023 02:24 — forked from pazdera/gist:1040939
Python main template
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Short description of this Python module.
Longer description of this module.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
@wolftales
wolftales / ansible cheat sheet
Last active August 9, 2024 13:26 — forked from githubfoam/ansible cheat sheet
ansible cheat sheet
----------------------------------------------------------------------------------------------------------------------
# Not inventory, remote passwordless ssh connection
[clients]
control01 ansible_host=192.168.45.10 ansible_connection=ssh ansible_ssh_port=22 ansible_ssh_private_key_file=/home/vagrant/.ssh/id_rsa ansible_user=vagrant
#vagrant-client01 ansible_host=10.10.40.94 ansible_ssh_private_key_file='.vagrant/machines/vagrant-client01/virtualbox/private_key' ansible_connection=local ansible_ssh_user='vagrant'
[all:vars]
ansible_python_interpreter=/usr/bin/python3
----------------------------------------------------------------------------------------------------------------------
# Running a playbook in dry-run mode