puzzle / puzzle.opnsense

An Ansible Collection to configure an opnsense Firewall
https://puzzle.github.io/puzzle.opnsense/collections/puzzle/opnsense/index.html
GNU General Public License v3.0
23 stars 12 forks source link

API key can't be set #126

Closed sangdrax8 closed 2 months ago

sangdrax8 commented 4 months ago

Describe the bug You take a list of strings for setting an API key, but this isn't a list of dictionaries. Therefore one can not pass in both the key and the secret, which would be required to set a known functioning key. In fact, what it does now is somewhat destructive. This module will set the given key, while generating a new secret for it. This will cause the expected key to have a now unknown to the user secret. If the user tried to pass in both key and secret in the list, they would just get 2 new keys, neither of which they know.

To Reproduce Steps to reproduce the behavior:

  1. take an existing key/secret pair
  2. attempt to set this key with the module

Expected behavior An API can be set to an exact known key/secret. It would be nice if the api list was a list of dictionaries. Much like you generate. This way the user could pass in

api_key:
  - key=XXXX
    secret=YYYY
  - key=AAAA
    secret=BBBB

Environment

Additional context This would be really useful for molecule, as I could hard code a "testing" key/secret pair in my molecule inventory. Then have my role deploy this key only in a molecule instance. This would allow me to use the API (or ansibleguys modules) in molecule with out any manual intervention to update the API key/secret every time I bring it up.

KiLLuuuhh commented 3 months ago

Hello @sangdrax8

Thank you for taking the time and contribute to this project.

Your absolutely right about this, we will fix this with the next release.