1

I would like to list all minions that match my compound targeting string. I have already looked at this question How to get a list of all salt minions in a template? but my question is a little bit different as I need to use compound matching. Also I may be hitting this bug: https://github.com/saltstack/salt/issues/18878

Take as example below template:

{% for host in salt['publish.publish']('G@roles:hadoop_master', 'network.interfaces', expr_form='compound') %}
echo {{ host }}:
  cmd.run
{% endfor %}

The problem is that it's not showing any data.

While the following template is working as expected:

{% for host in salt['publish.publish']('*', 'network.interfaces') %}
echo {{ host }}:
  cmd.run
{% endfor %}

I have also tried using the mine:

{% for host, hostinfo in salt['mine.get']('G@roles:hadoop_master', 'network.interfaces', 'compound').items() %}
echo {{ host }}:
  cmd.run
{% endfor %}

I have done all nessecary prequisites to setup mine and peer/publish. This is enabled on master /etc/salt/master:

peer:
  .*:
    - network.ip_addrs
    - network.interfaces

And following config is on minion /etc/salt/minion:

mine_functions:
    network.interfaces: []
    network.ip_addrs: []
    grains.items: []
Community
  • 1
  • 1
Sam Stoelinga
  • 4,881
  • 7
  • 39
  • 54
  • Have you tried testing your compound matcher from the master? `salt -C 'G@roles:hadoop_master' network.interfaces` – Utah_Dave Dec 15 '14 at 05:09
  • Sorry for forgetting to answer the question. There is a known bug so it was disabled for mine and peer. See my answer below. – Sam Stoelinga Dec 15 '14 at 08:35

1 Answers1

1

Quoting the answer from whiteinge https://github.com/saltstack/salt/issues/18878#issuecomment-66865740:

Compound matching for Mine and Peer was disabled in 2014.7.0 and will be re-enabled in 2014.7.1. See the note at the top of the release notes:

http://docs.saltstack.com/en/latest/topics/releases/2014.7.0.html

Sam Stoelinga
  • 4,881
  • 7
  • 39
  • 54