salt.beacons.bonjour_announce

Beacon to announce via Bonjour (zeroconf)

salt.beacons.bonjour_announce.beacon(config)

Broadcast values via zeroconf

If the announced values are static, it is advised to set run_once: True (do not poll) on the beacon configuration.

The following are required configuration settings:

  • servicetype - The service type to announce

  • port - The port of the service to announce

  • txt - The TXT record of the service being announced as a dict. Grains can be used to define TXT values using one of following two formats:

    • grains.<grain_name>

    • grains.<grain_name>[i] where i is an integer representing the index of the grain to use. If the grain is not a list, the index is ignored.

The following are optional configuration settings:

  • servicename - Set the name of the service. Will use the hostname from the minion's host grain if this value is not set.

  • reset_on_change - If True and there is a change in TXT records detected, it will stop announcing the service and then restart announcing the service. This interruption in service announcement may be desirable if the client relies on changes in the browse records to update its cache of TXT records. Defaults to False.

  • reset_wait - The number of seconds to wait after announcement stops announcing and before it restarts announcing in the case where there is a change in TXT records detected and reset_on_change is True. Defaults to 0.

  • copy_grains - If True, Salt will copy the grains passed into the beacon when it backs them up to check for changes on the next iteration. Normally, instead of copy, it would use straight value assignment. This will allow detection of changes to grains where the grains are modified in-place instead of completely replaced. In-place grains changes are not currently done in the main Salt code but may be done due to a custom plug-in. Defaults to False.

Example Config

beacons:
  bonjour_announce:
    - run_once: True
    - servicetype: _demo._tcp
    - port: 1234
    - txt:
        ProdName: grains.productname
        SerialNo: grains.serialnumber
        Comments: 'this is a test'

salt.beacons.bonjour_announce.validate(config)

Validate the beacon configuration

© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/beacons/all/salt.beacons.bonjour_announce.html