Skip to content

Instantly share code, notes, and snippets.

Avatar

Gerard Lynch halberom

View GitHub Profile
@halberom
halberom / 00_play.yml
Last active Oct 31, 2019
ansible - example of selecting from list of dicts
View 00_play.yml
---
- 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 Jun 12, 2019
ansible - example of using default() with different var states
View 00_play.yml
---
- hosts: localhost
gather_facts: false
vars:
foo: ''
bar: foo
#abc
xyz: true
tasks:
- debug:
@halberom
halberom / 01_play.yml
Last active May 10, 2019
ansible - example of appending to list one or more vars and handling '' or undefined.
View 01_play.yml
---
- hosts: localhost
connection: local
gather_facts: false
vars:
mylist:
- one
- two
- three
myvar1: foo
@halberom
halberom / output
Created May 3, 2019
ansible - example of handling list item default
View output
PLAY [localhost] ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [file] ************************************************************************************************************************************************************************************************************************************************************************
@halberom
halberom / easier_output
Last active May 3, 2019
ansible - example of getting subset of hash using list
View easier_output
PLAY [localhost] ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [set_fact] ********************************************************************************************************************************************************************************************************************************************************************
@halberom
halberom / Makefile
Last active Jan 13, 2019
CICD semantic versioning foo - bump a repository version based on past tags instead of VERSION file
View Makefile
.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)
View 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 Sep 27, 2018
ansible - example of extracting all ipaddresses in the range 192.168.0.0/24 for hosts matching pattern
View play.yml
---
- 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:
@halberom
halberom / output
Last active Jul 10, 2018
ansible - example of using default var or result from nested dict
View output
PLAY [localhost] ***************************************************************************************************************************************************************************************************************************************************************
TASK [debug] *******************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
"msg": "a exists!"
}
PLAY [this should work, it doesn't] ********************************************************************************************************************************************************************************************************************************************
TASK [debug] ***********************************************************************************************************************************************
@halberom
halberom / output
Created Dec 6, 2017
ansible - example adding item to list using set_fact
View output
PLAY [localhost] ***************************************************************************************************************************************************************************************************************************************************************
TASK [set_fact] ****************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [debug] *******************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
"test_matrix_configs": [
"tlsproxy",
"neutron"
You can’t perform that action at this time.