Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support composable Hostmetadata #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mikemol
Copy link
Contributor

@mikemol mikemol commented Jun 12, 2017

Take advantage of Salt's pillar merging to compose host metadata; in
this way, we can apply multiple roles to a node and have the Zabbix
agent report the combination of applied roles to the Zabbix server. In
turn, we can automatically apply role-specific templates through the
Zabbix server's host registration process.

The following pillar data structures are all valid:

  • zabbix-agent: # Not mergable
    hostmetadata: my-host-metadata # Not mergable

  • zabbix-agent: # Not mergable; Zabbix cannot merge lists
    hostmetadata:
    - metadata component 1
    - metadata component 2
    - metadata component 3

  • zabbix-agent: # Supports pillar merging
    hostmetadata:
    metadata component 1:
    metadata component 2:
    metadata component 3:

mikemol added 2 commits June 12, 2017 17:30
The flexjoin() macro simplifies support for mergable and composable
structures. All three of these data structures will result in the string
'a s d f'. The third structure, using dicts, also supports pillar merging.

- 'a s d f'

- [ a, s, d, f]

- { a: ~, s: ~, d: ~, f: ~}
Take advantage of Salt's pillar merging to compose host metadata; in
this way, we can apply multiple roles to a node and have the Zabbix
agent report the combination of applied roles to the Zabbix server. In
turn, we can automatically apply role-specific templates through the
Zabbix server's host registration process.

The following pillar data structures are all valid:

- zabbix-agent: # Not mergable
    hostmetadata: my-host-metadata # Not mergable

- zabbix-agent: # Not mergable; Zabbix cannot merge lists
    hostmetadata:
      - metadata component 1
      - metadata component 2
      - metadata component 3

- zabbix-agent: # Supports pillar merging
    hostmetadata:
      metadata component 1:
      metadata component 2:
      metadata component 3:
@ghormoon
Copy link

with pillar_merge_lists: true even the second variant should work.
is there a reason not to merge this? would be useful not to have to hack it around to have a system of tags to use in autoregistration rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants