community.general.lmdb_kv (8.5.0) — lookup

fetch data from LMDB

| "added in version" 0.2.0 of community.general"

Authors: Jan-Piet Mens (@jpmens)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This lookup returns a list of results from an LMDB DB corresponding to a list of items given to it.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: query LMDB for a list of country codes
  ansible.builtin.debug:
    msg: "{{ query('community.general.lmdb_kv', 'nl', 'be', 'lu', db='jp.mdb') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: use list of values in a loop by key wildcard
  ansible.builtin.debug:
    msg: "Hello from {{ item.0 }} a.k.a. {{ item.1 }}"
  vars:
    - lmdb_kv_db: jp.mdb
  with_community.general.lmdb_kv:
     - "n*"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: get an item by key
  ansible.builtin.assert:
    that:
      - item == 'Belgium'
    vars:
      - lmdb_kv_db: jp.mdb
  with_community.general.lmdb_kv:
    - be

Inputs

    
db:
    default: ansible.mdb
    description: Path to LMDB database.
    type: str
    vars:
    - name: lmdb_kv_db

_terms:
    description: List of keys to query.
    elements: str
    type: list

Outputs

_raw:
  description: value(s) stored in LMDB
  elements: raw
  type: list