diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-26 04:05:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-26 04:05:56 +0000 |
commit | 67c6a4d1dccb62159b9d9b2dea4e2f487446e276 (patch) | |
tree | 9ccbb35137f480bbbdb899accbda52a8135d3416 /ansible_collections/cisco/intersight/plugins | |
parent | Adding upstream version 9.4.0+dfsg. (diff) | |
download | ansible-67c6a4d1dccb62159b9d9b2dea4e2f487446e276.tar.xz ansible-67c6a4d1dccb62159b9d9b2dea4e2f487446e276.zip |
Adding upstream version 9.5.1+dfsg.upstream/9.5.1+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cisco/intersight/plugins')
-rw-r--r-- | ansible_collections/cisco/intersight/plugins/modules/intersight_local_user_policy.py | 54 | ||||
-rw-r--r-- | ansible_collections/cisco/intersight/plugins/modules/intersight_server_profile.py | 8 |
2 files changed, 30 insertions, 32 deletions
diff --git a/ansible_collections/cisco/intersight/plugins/modules/intersight_local_user_policy.py b/ansible_collections/cisco/intersight/plugins/modules/intersight_local_user_policy.py index 9bb58065d..1124da980 100644 --- a/ansible_collections/cisco/intersight/plugins/modules/intersight_local_user_policy.py +++ b/ansible_collections/cisco/intersight/plugins/modules/intersight_local_user_policy.py @@ -197,14 +197,28 @@ def main(): ) intersight = IntersightModule(module) + organization_moid = None + # get Organization Moid + intersight.get_resource( + resource_path='/organization/Organizations', + query_params={ + '$filter': "Name eq '" + intersight.module.params['organization'] + "'", + '$select': 'Moid', + }, + ) + if intersight.result['api_response'].get('Moid'): + # resource exists and moid was returned + organization_moid = intersight.result['api_response']['Moid'] intersight.result['api_response'] = {} intersight.result['trace_id'] = '' # get the current state of the resource + filter_str = "Name eq '" + intersight.module.params['name'] + "'" + filter_str += "and Organization.Moid eq '" + organization_moid + "'" intersight.get_resource( resource_path='/iam/EndPointUserPolicies', query_params={ - '$filter': "Name eq '" + intersight.module.params['name'] + "'", + '$filter': filter_str, '$expand': 'EndPointUserRoles($expand=EndPointRole,EndPointUser),Organization', }, ) @@ -269,34 +283,18 @@ def main(): 'EnablePasswordExpiry': intersight.module.params['enable_password_expiry'], 'PasswordHistory': intersight.module.params['password_history'], }, + 'Organization': { + 'Moid': organization_moid + }, } - organization_moid = None - if not user_policy_moid or module.params['purge']: - # get Organization Moid which is needed when resources are created - saved_response = intersight.result['api_response'] - intersight.get_resource( - resource_path='/organization/Organizations', - query_params={ - '$filter': "Name eq '" + intersight.module.params['organization'] + "'", - '$select': 'Moid', - }, - ) - if intersight.result['api_response'].get('Moid'): - # resource exists and moid was returned - organization_moid = intersight.result['api_response']['Moid'] - intersight.result['api_response'] = saved_response - if not user_policy_moid: - # Initial create: Organization must be set, but can't be changed after initial POST - intersight.api_body['Organization'] = { - 'Moid': organization_moid, - } - elif module.params['purge']: - # update existing resource and purge any existing users - for end_point_user_role in intersight.result['api_response']['EndPointUserRoles']: - intersight.delete_resource( - moid=end_point_user_role['Moid'], - resource_path='/iam/EndPointUserRoles', - ) + + if module.params['purge']: + # update existing resource and purge any existing users + for end_point_user_role in intersight.result['api_response']['EndPointUserRoles']: + intersight.delete_resource( + moid=end_point_user_role['Moid'], + resource_path='/iam/EndPointUserRoles', + ) # configure the top-level policy resource intersight.result['api_response'] = {} intersight.configure_resource( diff --git a/ansible_collections/cisco/intersight/plugins/modules/intersight_server_profile.py b/ansible_collections/cisco/intersight/plugins/modules/intersight_server_profile.py index 49cdb61b6..8746bdc31 100644 --- a/ansible_collections/cisco/intersight/plugins/modules/intersight_server_profile.py +++ b/ansible_collections/cisco/intersight/plugins/modules/intersight_server_profile.py @@ -330,15 +330,15 @@ def main(): if moid and intersight.module.params['boot_order_policy']: post_profile_to_policy(intersight, moid, resource_path='/boot/PrecisionPolicies', policy_name=intersight.module.params['boot_order_policy']) if moid and intersight.module.params['certificate_policy']: - post_profile_to_policy(intersight, moid, resource_path='/security/CertificatePolicies', policy_name=intersight.module.params['certificate_policy']) + post_profile_to_policy(intersight, moid, resource_path='/certificatemanagement/Policies', policy_name=intersight.module.params['certificate_policy']) if moid and intersight.module.params['drive_security_policy']: - post_profile_to_policy(intersight, moid, resource_path='/security/DriveSecurityPolicies', policy_name=intersight.module.params['drive_security_policy']) + post_profile_to_policy(intersight, moid, resource_path='/storage/DriveSecurityPolicies', policy_name=intersight.module.params['drive_security_policy']) if moid and intersight.module.params['firmware_policy']: post_profile_to_policy(intersight, moid, resource_path='/firmware/Policies', policy_name=intersight.module.params['firmware_policy']) if moid and intersight.module.params['imc_access_policy']: post_profile_to_policy(intersight, moid, resource_path='/access/Policies', policy_name=intersight.module.params['imc_access_policy']) if moid and intersight.module.params['ipmi_over_lan_policy']: - post_profile_to_policy(intersight, moid, resource_path='/ipmi/Policies', policy_name=intersight.module.params['ipmi_over_lan_policy']) + post_profile_to_policy(intersight, moid, resource_path='/ipmioverlan/Policies', policy_name=intersight.module.params['ipmi_over_lan_policy']) if moid and intersight.module.params['lan_connectivity_policy']: post_profile_to_policy(intersight, moid, resource_path='/vnic/LanConnectivityPolicies', policy_name=intersight.module.params['lan_connectivity_policy']) if moid and intersight.module.params['local_user_policy']: @@ -348,7 +348,7 @@ def main(): if moid and intersight.module.params['san_connectivity_policy']: post_profile_to_policy(intersight, moid, resource_path='/vnic/SanConnectivityPolicies', policy_name=intersight.module.params['san_connectivity_policy']) if moid and intersight.module.params['serial_over_lan_policy']: - post_profile_to_policy(intersight, moid, resource_path='/serial/Policies', policy_name=intersight.module.params['serial_over_lan_policy']) + post_profile_to_policy(intersight, moid, resource_path='/sol/Policies', policy_name=intersight.module.params['serial_over_lan_policy']) if moid and intersight.module.params['snmp_policy']: post_profile_to_policy(intersight, moid, resource_path='/snmp/Policies', policy_name=intersight.module.params['snmp_policy']) if moid and intersight.module.params['storage_policy']: |