hubblestack/pulsar

Make hubblestack_pulsar_config_generated.yaml as a pillar dump

Closed this issue · 2 comments

It would be nice if pulsar would have a state that will dump pillar contents into a hubblestack_pulsar_config_generated.yaml file.

My use-case: We use librarian-salt to get all formulas at package creation time. I don't want to manage hubblestack_pulsar_config.yaml as it's part of the formula and all our code is using formulas only.

This means i need to store this custom file of mine somewhere. I don't want is as a file on the salt fileserver because all we do is include formulas and configure pillar information there. It would be nice to have a state named that would allow me to do something along these lines:

my_role.sls

include:
  - pulsar

my_pillar.sls (or in a defaults.yaml that's merged with pillar data)

hubblestack:
  hubblestack_pulsar_config:
    /lib: { recurse: True, auto_add: True }
    /bin: { recurse: True, auto_add: True }
    ...

Pulsar/pulsar/init.sls

generate_pulsar_config:
  file.managed:
    - name: {{ pulsar.config_file }}
    - user: root
    - group: root
    - mode: '0600'
    - contents: |
        {{ pulsar.hubblestack_pulsar_config | indent(8) }}

What you get:

  • this way i can merge pillar data that depends on my role. (e.g. don't put postgres lib directory on the watch list)

What you pay:

  • a state

Easy way out:

  • just put the config file on your salt fileserver somewhere

I think you could do this right now, with no modification to pulsar. In the latest version, pulsar doesn't pull its data from pillar or from the fileserver -- rather, it just looks for a file on the filesystem, which you can sync using a scheduled cp.cache_file job.

So, if instead of the cp.cache_file job you just do a state.sls and target your file.managed state, you could easily generate this file on a per-minion basis.

I'm going to close this for now, but I'll monitor if you have more questions.