Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UpdateUserAccountTypes command to redfish_command #9059

Merged

Conversation

sseekamp
Copy link
Contributor

SUMMARY

Add UpdateUserAccountTypes command to redfish_command module accepting account_accounttypes or account_oemaccounttypes

Fixes #9058

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

redfish_command
rf_utils

ADDITIONAL INFORMATION

Sample task using the new command:

    - name: Modify existing user account types
      community.general.redfish_command:
        category: Accounts
        command: UpdateUserAccountTypes
        baseuri: "{{ bmc_address }}"
        username: "admin"
        password: "{{ bmc_password }}"
        account_username: example_user
        account_types:
          - Redfish
          - KVMIP
      register: redfish_results

Sample output - no change required:

PLAY [test account mod] ****************************************************************************************************************************************************************************

TASK [modify account] ***************************************************************************************************************************************************************************
Friday 25 October 2024  23:15:15 +0000 (0:00:00.009)       0:00:00.009 ********
ok: [localhost] => changed=false
  msg: Action was successful
  return_values: {}
  session: {}

TASK [debug] *****************************************************************************************************************************************************************************************
Friday 25 October 2024  23:15:16 +0000 (0:00:01.610)       0:00:01.619 ********
ok: [localhost] =>
  redfish_results:
    changed: false
    failed: false
    msg: Action was successful
    return_values: {}
    session: {}

PLAY RECAP *******************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Sample output change required:

PLAY [test account mod] ****************************************************************************************************************************************************************************

TASK [modify account] ***************************************************************************************************************************************************************************
Friday 25 October 2024  23:16:11 +0000 (0:00:00.009)       0:00:00.009 ********
changed: [localhost] => changed=true
  msg: Action was successful
  return_values: {}
  session: {}

TASK [debug] *****************************************************************************************************************************************************************************************
Friday 25 October 2024  23:16:12 +0000 (0:00:01.327)       0:00:01.336 ********
ok: [localhost] =>
  redfish_results:
    changed: true
    failed: false
    msg: Action was successful
    return_values: {}
    session: {}

PLAY RECAP *******************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Sample error output:

PLAY [test account mod] ****************************************************************************************************************************************************************************

TASK [Set add new account] ***************************************************************************************************************************************************************************
Friday 25 October 2024  23:17:30 +0000 (0:00:00.009)       0:00:00.009 ********
fatal: [localhost]: FAILED! => changed=false
  msg: Must provide account_accounttypes or account_oemaccounttypes for UpdateUserAccountTypes command

PLAY RECAP *******************************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0****************************************************************************************************************************************************************************

modified account record:

{
  "@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
  "@odata.etag": "W/\"1729898163\"",
  "@odata.id": "/redfish/v1/AccountService/Accounts/5",
  "@odata.type": "#ManagerAccount.v1_5_0.ManagerAccount",
  "AccountTypes": [
    "Redfish"
  ],
  "Description": "Collection of Account Details",
  "Enabled": true,
  "Id": "5",
  "Links": {
    "Role": {
      "@odata.id": "/redfish/v1/AccountService/Roles/Administrator"
    }
  },
  "Locked": false,
  "Name": "example_user",
  "Password": "",
  "PasswordChangeRequired": false,
  "RoleId": "Administrator",
  "UserName": "example_user"
}

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module module_utils module_utils plugins plugin (any type) labels Oct 25, 2024
@felixfontein felixfontein added the check-before-release PR will be looked at again shortly before release and merged if possible. label Oct 26, 2024
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

…es.yml


Update changelog fragment

Co-authored-by: Felix Fontein <[email protected]>
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mraineri
Copy link
Contributor

Looks good, thanks!

shipit

@felixfontein felixfontein merged commit 3506f73 into ansible-collections:main Oct 28, 2024
126 checks passed
@felixfontein
Copy link
Collaborator

@sseekamp thanks for your contribution!
@russoz @mraineri thanks for reviewing!

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Oct 28, 2024
@sseekamp sseekamp deleted the sseekamp/rf-account-types branch December 9, 2024 23:22
Massl123 pushed a commit to Massl123/community.general that referenced this pull request Feb 7, 2025
…tions#9059)

* Add UpdateUserAccountTypes command to redfish_command

ansible-collections#9058

* Add changelog fragment

* Update changelogs/fragments/9059-redfish_command-updateuseraccounttypes.yml

Update changelog fragment

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module_utils module_utils module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a ModifyAccount or ModifyAccountTypes command to the redfish_command module
5 participants