summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/intersight
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/cisco/intersight')
-rw-r--r--ansible_collections/cisco/intersight/CHANGELOG.md3
-rw-r--r--ansible_collections/cisco/intersight/FILES.json6
-rw-r--r--ansible_collections/cisco/intersight/MANIFEST.json4
-rw-r--r--ansible_collections/cisco/intersight/plugins/modules/intersight_local_user_policy.py54
-rw-r--r--ansible_collections/cisco/intersight/plugins/modules/intersight_server_profile.py8
5 files changed, 38 insertions, 37 deletions
diff --git a/ansible_collections/cisco/intersight/CHANGELOG.md b/ansible_collections/cisco/intersight/CHANGELOG.md
index 20035122b..1ed1a5e3e 100644
--- a/ansible_collections/cisco/intersight/CHANGELOG.md
+++ b/ansible_collections/cisco/intersight/CHANGELOG.md
@@ -1,5 +1,8 @@
# cisco.intersight Ansible Collection Changelog
+## Version 2.0.8
+- Fix issue #111 to allow User Policy updates
+
## Version 2.0.7
- Fix issue #101 to support IMM Server Policies.
- Update deploy_server_profiles playbook to support Unassign
diff --git a/ansible_collections/cisco/intersight/FILES.json b/ansible_collections/cisco/intersight/FILES.json
index 32d2289e2..95315ee60 100644
--- a/ansible_collections/cisco/intersight/FILES.json
+++ b/ansible_collections/cisco/intersight/FILES.json
@@ -46,7 +46,7 @@
"name": "CHANGELOG.md",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "e12da2fc549bdadafdd809c920214a67f6fb569d016359e3d81a514d575ded3f",
+ "chksum_sha256": "184c0ed03fe6bbd200481b356aab0a3e8c92fbb08bcf3ca6057c53fac6e65e1d",
"format": 1
},
{
@@ -116,7 +116,7 @@
"name": "plugins/modules/intersight_server_profile.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "957fd1ca38a9a759a24e6b8f0a245be48f711f4ffce14b816799ea06cf2924c8",
+ "chksum_sha256": "4de9635cc96bb2469e78e7b0be17fa85a4692ee3821f3b7d490d9d2376fef6e3",
"format": 1
},
{
@@ -151,7 +151,7 @@
"name": "plugins/modules/intersight_local_user_policy.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "7113b95de82882c33ca13674cc7210db4e9d11ffb753a53776dd3f8ced8ab4cd",
+ "chksum_sha256": "37256848d5a123bcae5204c7fcdde7aba8a4eb0f3ca117473cce0a6a418e2373",
"format": 1
},
{
diff --git a/ansible_collections/cisco/intersight/MANIFEST.json b/ansible_collections/cisco/intersight/MANIFEST.json
index 6b211f2c6..990405175 100644
--- a/ansible_collections/cisco/intersight/MANIFEST.json
+++ b/ansible_collections/cisco/intersight/MANIFEST.json
@@ -2,7 +2,7 @@
"collection_info": {
"namespace": "cisco",
"name": "intersight",
- "version": "2.0.7",
+ "version": "2.0.8",
"authors": [
"David Soper (@dsoper2)"
],
@@ -27,7 +27,7 @@
"name": "FILES.json",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "0a61cf97c55cb7fea120fa4d211ada5f4c5929bd8b617b9213d7b19cc3302c68",
+ "chksum_sha256": "7958d8bc5047610831777f3a56171c17f505aff4bd24acfe861039c60da2c771",
"format": 1
},
"format": 1
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']: