Skip to content

Instantly share code, notes, and snippets.

@halberom
halberom / Dockerfile
Created October 21, 2024 04:42
goss troubleshooting
FROM ghcr.io/goss-org/goss as goss
FROM python
COPY --from=goss /usr/bin/goss /usr/bin/goss
WORKDIR /app
COPY goss.yaml .
COPY main.py .
COPY --chmod=755 entrypoint.sh .
@halberom
halberom / main.tf
Created April 29, 2024 06:35
Terraform detected the following changes - example code.
data "aws_ami" "amazon_linux_2" {
most_recent = true
filter {
name = "owner-alias"
values = ["amazon"]
}
filter {
name = "name"
@halberom
halberom / 00_play.yml
Last active October 31, 2019 09:51
ansible - example of selecting from list of dicts
---
- hosts: localhost
gather_facts: false
connection: local
vars:
nvidia_cards_and_drivers:
# Comment the following list item to see the difference
- model: "Quadro FX 5800"
driver_version: "340xx"
- model: "Quadro 4000"
@halberom
halberom / 00_play.yml
Created June 12, 2019 08:18
ansible - example of using default() with different var states
---
- hosts: localhost
gather_facts: false
vars:
foo: ''
bar: foo
#abc
xyz: true
tasks:
- debug:
@halberom
halberom / 01_play.yml
Last active May 19, 2021 03:15
ansible - example of appending to list one or more vars and handling '' or undefined.
---
- hosts: localhost
connection: local
gather_facts: false
vars:
mylist:
- one
- two
- three
myvar1: foo
@halberom
halberom / output
Created May 3, 2019 11:25
ansible - example of handling list item default
PLAY [localhost] ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [file] ************************************************************************************************************************************************************************************************************************************************************************
@halberom
halberom / easier_output
Last active May 3, 2019 10:21
ansible - example of getting subset of hash using list
PLAY [localhost] ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [set_fact] ********************************************************************************************************************************************************************************************************************************************************************
@halberom
halberom / Makefile
Last active October 13, 2022 13:59
CICD semantic versioning foo - bump a repository version based on past tags instead of VERSION file
.PHONY: bump
# version bump, assumes we're in treeder/bump in CircleCI
bump:
@git config --global user.email "-"
@git config --global user.name "CircleCi"
@(git tag --sort=-creatordate | grep -E '^\d+\.\d+\.\d+$$' || echo '0.0.0') | head -n 1 > VERSION
@/script/bump $$(git log -1 --pretty=%B)
@git tag $$(cat VERSION)
@git push origin $$(cat VERSION)
@halberom
halberom / keybase.md
Created October 8, 2018 15:33
keybase.md

Keybase proof

I hereby claim:

  • I am halberom on github.
  • I am gerardlynch (https://keybase.io/gerardlynch) on keybase.
  • I have a public key ASALLonWT65ma5yZLjCR-s7duB_Iuf_bcCosizZhabxVXwo

To claim this, I am signing this object:

@halberom
halberom / play.yml
Created September 27, 2018 14:32
ansible - example of extracting all ipaddresses in the range 192.168.0.0/24 for hosts matching pattern
---
- hosts: "{{ pattern }}"
gather_facts: True
tasks:
- name: combine all ipv4
set_fact:
all_ipv4: "{{ all_ipv4 + ansible_all_ipv4_addresses }}"
- name: reduce to matching ip's
set_fact: