salt-formulas / salt-formula-freeipa

Other
20 stars 35 forks source link

Use the servers list from the map #15

Closed p3lim closed 3 years ago

p3lim commented 3 years ago

The ipa_servers list is already managed in the map, so there's no reason to not use it for everything.

p3lim commented 3 years ago

I think there is a misunderstanding here. In the configuration for the client there are two ways to define one or multiple FreeIPA servers:

freeipa:
  client:
    # one way
    server: ipa.example.com
    # another way
    servers:
      - ipa.example.com

Regardless of which way you define the server(s) these will end up in the ipa_servers list from the map: https://github.com/salt-formulas/salt-formula-freeipa/blob/583cbcda4479d26d297aab7db3289024f30de7b6/freeipa/map.jinja#L55-L60

This list is imported into the client state: https://github.com/salt-formulas/salt-formula-freeipa/blob/583cbcda4479d26d297aab7db3289024f30de7b6/freeipa/client/init.sls#L1

And it's even used for the host creation id freeipa_host_add: https://github.com/salt-formulas/salt-formula-freeipa/blob/583cbcda4479d26d297aab7db3289024f30de7b6/freeipa/client/init.sls#L32 https://github.com/salt-formulas/salt-formula-freeipa/blob/583cbcda4479d26d297aab7db3289024f30de7b6/freeipa/client/init.sls#L56

All this PR does it to use the same existing definition of server(s) that already exist, giving the user a choice on how to define them.