ansible.builtin.znode (v2.9.27) — module

Create, delete, retrieve, and update znodes using ZooKeeper

| "added in version" 2.0 of ansible.builtin"

Authors: Trey Perry (@treyperry)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

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


Requirements

Usage examples

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

Inputs

    
op:
    description:
    - An operation to perform. Mutually exclusive with state.

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

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

state:
    description:
    - The state to enforce. Mutually exclusive with op.

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

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

recursive:
    default: 'no'
    description:
    - Recursively delete node and all its children.
    type: bool
    version_added: '2.1'
    version_added_collection: ansible.builtin