Skip to content

Instantly share code, notes, and snippets.

View berlic's full-sized avatar

Konstantin Suvorov berlic

View GitHub Profile
@berlic
berlic / json_query.py
Created September 21, 2017 08:15
Patched json_query filter for Ansible to work with ansible strings types and has `to_entries` and `from_entries` jq-like functions
# (c) 2015, Filipe Niero Felisbino <filipenf@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distributed in the hope that it will be useful,
@berlic
berlic / playbook.yml
Created July 25, 2017 08:01
yaml combine
---
- hosts: localhost
gather_facts: no
vars:
config_files:
- test1
- test2
tasks:
- name: Load config defaults
include_vars:
@berlic
berlic / playbook.yml
Created July 12, 2017 12:29
bool conversion demo
---
- hosts: localhost
gather_facts: no
tasks:
- debug: msg=var1
when: var1
- debug: msg=var2
when: var2
- debug: msg=both
when: var1 or var2
@berlic
berlic / vars_demo.yml
Created March 8, 2017 07:25
Show problems when accessing vars via undocumented `vars` dict
---
- hosts: localhost
gather_facts: no
vars:
var1: hello
var2: "{{ var1 }}"
var_name: var2
tasks:
- debug: msg="{{ var2 }}"
- debug: msg="{{ vars[var_name] }}"
@berlic
berlic / etcd2.py
Created May 31, 2016 14:02
Patched etcd lookup plugin for ansible (support v2 API)
# (c) 2013, Jan-Piet Mens <jpmens(at)gmail.com>
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distributed in the hope that it will be useful,