---
# Example Playbook: cisco.intersight.intersight_..._policy
# Runs on localhost since policies are only configured once
- hosts: localhost
  connection: local
  collections:
    - cisco.intersight
  gather_facts: false
  vars:
    # Create an anchor for api_info that can be used throughout the file
    api_info: &api_info
      api_private_key: "{{ api_private_key }}"
      api_key_id: "{{ api_key_id }}"
      api_uri: "{{ api_uri | default(omit) }}"
  tasks:
    - name: Configure IMC Access policy
      intersight_imc_access_policy:
        <<: *api_info
        name: "{{ imc_access_name | default('sjc02-d23-access') }}"
        tags:
          - Key: Site
            Value: SJC02
        description: Updated IMC access for SJC labs
        vlan_id: "{{ imc_access_vlan | default(131) }}"
        ip_pool: "{{ ip_pool | default('sjc02-d23-ext-mgmt') }}"
