Create Hostgroups from imported puppet nodes

Solution 2: “Use Fileshipper”, they (Tom :slight_smile: ) said. “It works”, they said. “It may ruin your nerves with assign_filters”, I say…

Steps:

  • Create a CSV from the two curl calls and add a column header “hostgroup”
  • add this file to a fileshipper source directory (don’t forget to handcraft imports.ini first :frowning: )
  • create import source with that file
  • create sync rule with object_name = ${hostgroup}

That creates all groups in director!

I also tried to add an assign_filter there, but I need:
assign where "${hostgroup}" == "role_"+host.vars.role
but I could not convince director to create this…
It always created something with “contains” or “= null” or “in =” …

So I added a “groups” modifier to the hosts sync rule, which works at the end.

This is much nicer than the first puppet solution, but still not perfect…

What I really hate is the fact, that director tries to understand user provided filters and creates something unpredictable from that! Why not simply use the provided string and only replace ${variable}?