summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/intersight/playbooks/roles
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:27 +0000
commit3b0807ad7b283c46c21862eb826dcbb4ad04e5e2 (patch)
tree6461ea75f03eca87a5a90c86c3c9a787a6ad037e /ansible_collections/cisco/intersight/playbooks/roles
parentAdding debian version 7.7.0+dfsg-3. (diff)
downloadansible-3b0807ad7b283c46c21862eb826dcbb4ad04e5e2.tar.xz
ansible-3b0807ad7b283c46c21862eb826dcbb4ad04e5e2.zip
Merging upstream version 9.4.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cisco/intersight/playbooks/roles')
-rw-r--r--ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml22
1 files changed, 12 insertions, 10 deletions
diff --git a/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml b/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml
index 427b45d57..7867ca6bd 100644
--- a/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml
+++ b/ansible_collections/cisco/intersight/playbooks/roles/policies/server_policies/tasks/main.yml
@@ -1,5 +1,5 @@
---
-- name: "Configure {{ api_body.Name }} Server Policy"
+- name: "Configure Server Policy"
vars:
# Create an anchor for api_info that can be used throughout the file
api_info: &api_info
@@ -16,14 +16,22 @@
api_body: "{{ api_body }}"
register: policy_resp
# Append profile_resp list to policy
-- block:
+- name: "Append Profile list to Policy"
+ # Do not update if the profile isn't available
+ when:
+ - profile_resp is defined
+ - profile_resp.api_response.Moid is defined
+ - policy_resp is defined
+ - policy_resp.api_response.Profiles is defined
+ block:
# Create a list of all host's profile Moids
- - set_fact:
+ - name: "Create list of profile Moids"
+ ansible.builtin.set_fact:
# See the Ansible docs on json_query for info on how the Moid data is being extracted
profile_list: "{{ ansible_play_hosts | map('extract', hostvars, 'profile_resp') | list | json_query(moid_query) }}"
vars:
moid_query: "[*].api_response.{Moid: Moid, ObjectType: 'server.Profile'}"
- - name: "Update Server Profiles used by {{ api_body.Name }} Server Policy (change may always be reported)"
+ - name: "Update Server Profiles used by Server Policy (change may always be reported)"
cisco.intersight.intersight_rest_api:
<<: *api_info
resource_path: "{{ resource_path }}"
@@ -32,9 +40,3 @@
api_body: {
"Profiles": "{{ profile_list + policy_resp.api_response.Profiles }}"
}
- # Do not update if the profile isn't available
- when:
- - profile_resp is defined
- - profile_resp.api_response.Moid is defined
- - policy_resp is defined
- - policy_resp.api_response.Profiles is defined