---
- name: Manage Portal Global Settings on ISE
  hosts: ise_servers
  gather_facts: false
  tasks:
    - name: Get portal global setting
      cisco.ise.portal_global_setting_info:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
      register: portal_global_settings

    - name: Print portal global setting id
      ansible.builtin.debug:
        var: portal_global_settings['ise_response'][0]['id']
      when: not ansible_check_mode

    - name: Update portal global setting
      cisco.ise.portal_global_setting:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
        state: present
        id: "{{ portal_global_settings['ise_response'][0]['id'] }}"
        customization: HTML
      when: not ansible_check_mode
      register: result

    - name: Print result
      ansible.builtin.debug:
        var: result
