# salt.modules.zookeeper

## Zookeeper Module

maintainer:

  SaltStack

maturity:

  new

platform:

  all

depends:

  kazoo

New in version 2018.3.0.

### Configuration

configuration:

  This module is not usable until the following are specified either in a pillar or in the minion's config file:

      zookeeper:
        hosts: zoo1,zoo2,zoo3
        default_acl:
          - username: daniel
            password: test
            read: true
            write: true
            create: true
            delete: true
            admin: true
        username: daniel
        password: test

  If configuration for multiple zookeeper environments is required, they can be set up as different configuration profiles. For example:

      zookeeper:
        prod:
          hosts: zoo1,zoo2,zoo3
          default_acl:
            - username: daniel
              password: test
              read: true
              write: true
              create: true
              delete: true
              admin: true
          username: daniel
          password: test
        dev:
          hosts:
            - dev1
            - dev2
            - dev3
          default_acl:
            - username: daniel
              password: test
              read: true
              write: true
              create: true
              delete: true
              admin: true
          username: daniel
          password: test

salt.modules.zookeeper.create(path, value='', acls=None, ephemeral=False, sequence=False, makepath=False, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Create Znode

  path

    path of znode to create

  value

    value to assign to znode (Default: '')

  acls

    list of acl dictionaries to be assigned (Default: None)

  ephemeral

    indicate node is ephemeral (Default: False)

  sequence

    indicate node is suffixed with a unique index (Default: False)

  makepath

    Create parent paths if they do not exist (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)

  CLI Example:

      salt minion1 zookeeper.create /test/name daniel profile=prod

salt.modules.zookeeper.delete(path, version=-1, recursive=False, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Delete znode

  path

    path to znode

  version

    only delete if version matches (Default: -1 (always matches))

  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)

  CLI Example:

      salt minion1 zookeeper.delete /test/name profile=prod

salt.modules.zookeeper.ensure_path(path, acls=None, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Ensure Znode path exists

  path

    Parent path to create

  acls

    list of acls dictionaries to be assigned (Default: None)

  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)

  CLI Example:

      salt minion1 zookeeper.ensure_path /test/name profile=prod

salt.modules.zookeeper.exists(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Check if path exists

  path

    path to check

  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)

  CLI Example:

      salt minion1 zookeeper.exists /test/name profile=prod

salt.modules.zookeeper.get(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Get value saved in znode

  path

    path to check

  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)

  CLI Example:

      salt minion1 zookeeper.get /test/name profile=prod

salt.modules.zookeeper.get_acls(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Get acls on a znode

  path

    path to znode

  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)

  CLI Example:

      salt minion1 zookeeper.get_acls /test/name profile=prod

salt.modules.zookeeper.get_children(path, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Get children in znode path

  path

    path to check

  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)

  CLI Example:

      salt minion1 zookeeper.get_children /test profile=prod

salt.modules.zookeeper.make_digest_acl(username, password, read=False, write=False, create=False, delete=False, admin=False, allperms=False)

  Generate acl object

  Note

  This is heavily used in the zookeeper state and probably is not useful as a cli module

  username

    username of acl

  password

    plain text password of acl

  read

    read acl

  write

    write acl

  create

    create acl

  delete

    delete acl

  admin

    admin acl

  allperms

    set all other acls to True

  CLI Example:

      salt minion1 zookeeper.make_digest_acl username=daniel password=mypass allperms=True

salt.modules.zookeeper.set(path, value, version=-1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Update znode with new value

  path

    znode to update

  value

    value to set in znode

  version

    only update znode if version matches (Default: -1 (always matches))

  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)

  CLI Example:

      salt minion1 zookeeper.set /test/name gtmanfred profile=prod

salt.modules.zookeeper.set_acls(path, acls, version=-1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None)

  Set acls on a znode

  path

    path to znode

  acls

    list of acl dictionaries to set on the znode

  version

    only set acls if version matches (Default: -1 (always matches))

  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)

  CLI Example:

      salt minion1 zookeeper.set_acls /test/name acls='[{"username": "gtmanfred", "password": "test", "all": True}]' profile=prod