Pure-Storage-Ansible / FlashBlade-Collection

Ansible Collection for Pure Storage FlashBlade
GNU General Public License v3.0
3 stars 8 forks source link

multiple_keys param #232

Closed sdodsley closed 1 year ago

sdodsley commented 1 year ago
SUMMARY

Add new parameter multiple_keys to allow more than 1 access key to be created for a user, to the maximum allowed by Purity//FB. Default is false which will only allow a single access key for the user. Leaving this as the default will only allow 1 access key for the user, stopping additional keys being added on multiple runs of a playbook. Makes the module more idempotent.

ISSUE TYPE
COMPONENT NAME

purefb_s3user.py

RealKelsar commented 1 year ago

Hi, I tested it now and it got some weird failure mode.

If you set multiple_keys: false and then create the S3User, it gets one API Key. After the 1st Ok run it runs into this error with each new run:

"changed": false, "msg": "Object Store User trtesting/admin: Access Key creation failed"

If i let it create a 2nd API Key, more runs with multiple_keys: false work like expected without a change or error

Snippet of the Playbook:

    - name: Create object store user (with access ID and key) 'admin'
      purestorage.flashblade.purefb_s3user:
        fb_url: "{{ fburl }}"
        api_token: "{{ apikey }}"
        name: "admin"
        account: "{{ res_obj['account'] | d(res_meta['name']) }}"
        access_key: true
        multiple_keys: false
sdodsley commented 1 year ago

@RealKelsar thanks for checking out the patch. I have updated this, so hopefully the error you were seeing has been resolved.

RealKelsar commented 1 year ago

@sdodsley we are close ;)

It works now kind of like expected, only one key gets generated and it works on the 1st try, but now it is every time a 'changed'

It does not seem to change anything, key generation time stays the same.

sdodsley commented 1 year ago

@RealKelsar I think that should fix it...

RealKelsar commented 1 year ago

Works for me!