Update Sharepoint.yaml

This commit is contained in:
2025-08-14 06:46:12 +00:00
parent af51adcc09
commit 5f0d0afdba

View File

@@ -1,6 +1,6 @@
--- ---
- name: Post patching results to SharePoint (Graph) - name: Post patching results to SharePoint (Graph)
hosts: localhost hosts: windows
gather_facts: false gather_facts: false
vars: vars:
tenant_id: "{{ lookup('env', 'SP_TENANT_ID') }}" tenant_id: "{{ lookup('env', 'SP_TENANT_ID') }}"
@@ -27,6 +27,29 @@
URL={{ job_url }}. URL={{ job_url }}.
tasks: tasks:
- name: Verify siteId resolves
uri:
url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}"
method: GET
headers: { Authorization: "Bearer {{ graph_token.json.access_token }}" }
return_content: true
status_code: 200
register: site_probe
no_log: true
- name: List lists to confirm listId (name + id)
uri:
url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}/lists?$select=id,displayName"
method: GET
headers: { Authorization: "Bearer {{ graph_token.json.access_token }}" }
return_content: true
status_code: 200
register: lists_probe
no_log: true
- name: Show lists (sanitized)
debug:
msg: "{{ (lists_probe.json.value | default([])) | map(attribute='displayName') | list }}"
- name: Acquire Graph token (client credentials) - name: Acquire Graph token (client credentials)
uri: uri:
url: "https://login.microsoftonline.com/{{ tenant_id }}/oauth2/v2.0/token" url: "https://login.microsoftonline.com/{{ tenant_id }}/oauth2/v2.0/token"
@@ -42,6 +65,20 @@
no_log: true no_log: true
failed_when: graph_token.status not in [200] failed_when: graph_token.status not in [200]
- name: Inspect columns (internal names)
uri:
url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}/lists/{{ list_id }}/columns?$select=name,displayName,columnType"
method: GET
headers: { Authorization: "Bearer {{ graph_token.json.access_token }}" }
return_content: true
status_code: 200
register: cols_probe
no_log: true
- name: Print internal names
debug:
var: cols_probe.json.value | map(attribute='name') | list
- name: Create SharePoint list item (Graph) - name: Create SharePoint list item (Graph)
uri: uri:
url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}/lists/{{ list_id }}/items" url: "https://graph.microsoft.com/v1.0/sites/{{ site_id }}/lists/{{ list_id }}/items"