zookeeper

Manage Zookeeper znodes and ACLs statefully.

Important

This module requires the general Zookeeper setup.

ACLs

For more information about ACLs, please checkout the kazoo documentation.

https://kazoo.readthedocs.io/en/latest/api/security.html#kazoo.security.make_digest_acl

ACL dictionaries

The following options can be included in the acl dictionary:

username

Username to use for the ACL.

password

A plain-text password to hash.

write [bool]

Write permission.

create [bool]

Create permission.

delete [bool]

Delete permission.

admin [bool]

Admin permission.

all [bool]

All permissions.

saltext.zookeeper.states.zookeeper.present(name, value, acls=None, ephemeral=False, sequence=False, makepath=False, version=-1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Make sure znode is present in the correct state with the correct acls

name

path to znode

value

value znode should be set to

acls

list of acl dictionaries to set on znode (make sure the ones salt is connected with are included) Default: None

ephemeral

Boolean to indicate if ephemeral znode should be created Default: False

sequence

Boolean to indicate if znode path is suffixed with a unique index Default: False

makepath

Boolean to indicate if the parent paths should be created Default: False

version

For updating, specify the version which should be updated Default: -1 (always match)

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

add znode:
  zookeeper.present:
    - name: /test/name
    - value: gtmanfred
    - makepath: True

update znode:
  zookeeper.present:
    - name: /test/name
    - value: daniel
    - acls:
      - username: daniel
        password: test
        read: true
      - username: gtmanfred
        password: test
        read: true
        write: true
        create: true
        delete: true
        admin: true
    - makepath: True
saltext.zookeeper.states.zookeeper.absent(name, version=-1, recursive=False, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Make sure znode is absent

name

path to znode

version

Specify the version which should be deleted Default: -1 (always match)

recursive

Boolean to indicate if children should be recursively deleted Default: False

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

delete znode:
  zookeeper.absent:
    - name: /test
    - recursive: True
saltext.zookeeper.states.zookeeper.acls(name, acls, version=-1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)[source]

Update acls on a znode

name

path to znode

acls

list of acl dictionaries to set on znode

version

Specify the version which should be deleted Default: -1 (always match)

profile

Configured Zookeeper profile to authenticate with (Default: None)

hosts

Lists of Zookeeper Hosts (Default: ‘127.0.0.1:2181)

scheme

Scheme to authenticate with (Default: ‘digest’)

username

Username to authenticate (Default: None)

password

Password to authenticate (Default: None)

default_acl

Default acls to assign if a node is created in this connection (Default: None)

update acls:
  zookeeper.acls:
    - name: /test/name
    - acls:
      - username: daniel
        password: test
        all: True
      - username: gtmanfred
        password: test
        all: True