community.general.znode (8.5.0) — module

Create, delete, retrieve, and update znodes using ZooKeeper

Authors: Trey Perry (@treyperry)

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

Create, delete, retrieve, and update znodes using ZooKeeper.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Creating or updating a znode with a given value
  community.general.znode:
    hosts: 'localhost:2181'
    name: /mypath
    value: myvalue
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Getting the value and stat structure for a znode
  community.general.znode:
    hosts: 'localhost:2181'
    name: /mypath
    op: get
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Getting the value and stat structure for a znode using digest authentication
  community.general.znode:
    hosts: 'localhost:2181'
    auth_credential: 'user1:s3cr3t'
    name: /secretmypath
    op: get
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Listing a particular znode's children
  community.general.znode:
    hosts: 'localhost:2181'
    name: /zookeeper
    op: list
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Waiting 20 seconds for a znode to appear at path /mypath
  community.general.znode:
    hosts: 'localhost:2181'
    name: /mypath
    op: wait
    timeout: 20
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deleting a znode at path /mypath
  community.general.znode:
    hosts: 'localhost:2181'
    name: /mypath
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Creating or updating a znode with a given value on a remote Zookeeper
  community.general.znode:
    hosts: 'my-zookeeper-node:2181'
    name: /mypath
    value: myvalue
    state: present
  delegate_to: 127.0.0.1

Inputs

    
op:
    choices:
    - get
    - wait
    - list
    description:
    - An operation to perform. Mutually exclusive with state.
    type: str

name:
    description:
    - The path of the znode.
    required: true
    type: str

hosts:
    description:
    - A list of ZooKeeper servers (format '[server]:[port]').
    required: true
    type: str

state:
    choices:
    - present
    - absent
    description:
    - The state to enforce. Mutually exclusive with op.
    type: str

value:
    description:
    - The value assigned to the znode.
    type: str

timeout:
    default: 300
    description:
    - The amount of time to wait for a node to appear.
    type: int

use_tls:
    default: false
    description:
    - Using TLS/SSL or not.
    required: false
    type: bool
    version_added: 6.5.0
    version_added_collection: community.general

recursive:
    default: false
    description:
    - Recursively delete node and all its children.
    type: bool

auth_scheme:
    choices:
    - digest
    - sasl
    default: digest
    description:
    - Authentication scheme.
    required: false
    type: str
    version_added: 5.8.0
    version_added_collection: community.general

auth_credential:
    description:
    - The authentication credential value. Depends on O(auth_scheme).
    - The format for O(auth_scheme=digest) is C(user:password), and the format for O(auth_scheme=sasl)
      is C(user:password).
    required: false
    type: str
    version_added: 5.8.0
    version_added_collection: community.general