dresden-weekly / ansible-network-interfaces

Ansible roles to manage Ubuntu network interface configuration
MIT License
86 stars 62 forks source link

Any reason why you use the groupby filter #47

Closed tersmitten closed 7 years ago

tersmitten commented 7 years ago

Thanks for thew great role! I was curious why you use the groupby filter in the following line: https://github.com/dresden-weekly/ansible-network-interfaces/blob/develop/tasks/main.yml#L34

Doesn't a regular with_items give you enough data (in the correct format) in both tasks, handlers and templates?

arBmind commented 7 years ago

In theory it is not necessary, but if for some reason a device is mentioned twice, this would break really strange. Basically I could not come up with a usable API that is usable for all tasks and ensures a device is never mentioned twice.

tersmitten commented 7 years ago

Basically I could not come up with a usable API that is usable for all tasks and ensures a device is never mentioned twice

Where is this a problem?

arBmind commented 7 years ago

Good question. I don't remember the exact reasoning any more. Maybe it was that I needed to be able to combine configurations easily or I had issues with iterating a hash. But it may also be that the reason is gone now. Managing the device files is much more clean today, compared to my initial drafts. Maybe I intended to allow the mentioning of different operating modes for one device. I guess this won't fully work with our current templates and I cannot think of a use case for this. (Maybe a fallback?)

Now, we have to keep the config format or we break it for all the users. So we should at least have a very good reason to change it.

Sorry that I could not provide a better answer.

tersmitten commented 7 years ago

No problem, thanks for your explaination