---
# libvirt settings
cifmw_use_libvirt: true
cifmw_libvirt_manager_enable_sushy_emulator: true
cifmw_sushy_emulator_instance_node_name_prefix: compute
cifmw_libvirt_manager_pub_net: ocpbm
# cifmw_libvirt_manager_fixed_networks:
#   - trunk1
#   - trunk2
cifmw_use_sushy_emulator: true
cifmw_masquerade_networks: true
cifmw_masquerade_external_source_ranges:
  - "{{ cifmw_networking_definition.networks.ctlplane.network }}"
  - "192.168.32.1/20"
cifmw_networking_mapper_interfaces_info_translations:
  osp_trunk:
    - ctlplane
  trunk1:
    - ctlplane1
  trunk2:
    - ctlplane2
cifmw_libvirt_manager_default_gw_nets:
  - ocpbm
  - osp_trunk
  - trunk1
  - trunk2
cifmw_libvirt_manager_no_dnsmasq_nets:
  - trunk1
  - trunk2

cifmw_use_uefi: >-
  {{ (cifmw_repo_setup_os_release is defined
      and cifmw_repo_setup_os_release == 'rhel') | bool }}
cifmw_root_partition_id: >-
  {{
    (cifmw_repo_setup_os_release is defined and cifmw_repo_setup_os_release == 'rhel') |
    ternary(4, 1)
  }}

cifmw_libvirt_manager_extra_network_configuration:
  interfaces:
    - name: "vlan{{ cifmw_networking_definition.networks.internalapi.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-osp_trunk
        id: "{{ cifmw_networking_definition.networks.internalapi.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.internalapi.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.internalapi.network | ansible.utils.ipaddr('prefix') }}"
    - name: "vlan{{ cifmw_networking_definition.networks.storage.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-osp_trunk
        id: "{{ cifmw_networking_definition.networks.storage.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.storage.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.storage.network | ansible.utils.ipaddr('prefix') }}"
    - name: "vlan{{ cifmw_networking_definition.networks.tenant.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-osp_trunk
        id: "{{ cifmw_networking_definition.networks.tenant.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.tenant.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.tenant.network | ansible.utils.ipaddr('prefix') }}"
    - name: "vlan{{ cifmw_networking_definition.networks.internalapi1.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-trunk1
        id: "{{ cifmw_networking_definition.networks.internalapi1.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.internalapi1.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.internalapi1.network | ansible.utils.ipaddr('prefix') }}"
    - name: "vlan{{ cifmw_networking_definition.networks.storage1.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-trunk1
        id: "{{ cifmw_networking_definition.networks.storage1.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.storage1.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.storage1.network | ansible.utils.ipaddr('prefix') }}"
    - name: "vlan{{ cifmw_networking_definition.networks.tenant1.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-trunk1
        id: "{{ cifmw_networking_definition.networks.tenant1.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.tenant1.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.tenant1.network | ansible.utils.ipaddr('prefix') }}"
    - name: "vlan{{ cifmw_networking_definition.networks.internalapi2.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-trunk2
        id: "{{ cifmw_networking_definition.networks.internalapi2.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.internalapi2.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.internalapi2.network | ansible.utils.ipaddr('prefix') }}"
    - name: "vlan{{ cifmw_networking_definition.networks.storage2.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-trunk2
        id: "{{ cifmw_networking_definition.networks.storage2.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.storage2.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.storage2.network | ansible.utils.ipaddr('prefix') }}"
    - name: "vlan{{ cifmw_networking_definition.networks.tenant2.vlan }}"
      type: vlan
      state: up
      vlan:
        base-iface: cifmw-trunk2
        id: "{{ cifmw_networking_definition.networks.tenant2.vlan }}"
        protocol: 802.1q
      ipv4:
        enabled: true
        dhcp: false
        address:
          - ip: "{{ cifmw_networking_definition.networks.tenant2.gateway }}"
            prefix-length: "{{ cifmw_networking_definition.networks.tenant2.network | ansible.utils.ipaddr('prefix') }}"

# layout
cifmw_libvirt_manager_configuration:
  networks:
    osp_trunk: |
      <network>
        <name>osp_trunk</name>
        <forward mode='open'/>
        <bridge name='osp_trunk' stp='on' delay='0'/>
        <dns enable="no"/>
        <ip family='ipv4'
            address='{{ cifmw_networking_definition.networks.ctlplane.network |
                        ansible.utils.nthhost(1) }}'
            prefix='{{ cifmw_networking_definition.networks.ctlplane.network |
                       ansible.utils.ipaddr('prefix') }}'>
        </ip>
      </network>
    trunk1: |
      <network>
        <name>trunk1</name>
        <forward mode='open'/>
        <bridge name='trunk1' stp='on' delay='0'/>
        <dns enable="no"/>
        <ip family='ipv4'
            address='{{ cifmw_networking_definition.networks.ctlplane1.network |
                        ansible.utils.nthhost(1) }}'
            prefix='{{ cifmw_networking_definition.networks.ctlplane1.network |
                       ansible.utils.ipaddr('prefix') }}'>
        </ip>
        <ip family='ipv4' address='192.168.130.1' prefix='24'/>
      </network>
    trunk2: |
      <network>
        <name>trunk2</name>
        <forward mode='open'/>
        <bridge name='trunk2' stp='on' delay='0'/>
        <dns enable="no"/>
        <ip family='ipv4'
            address='{{ cifmw_networking_definition.networks.ctlplane2.network |
                        ansible.utils.nthhost(1) }}'
            prefix='{{ cifmw_networking_definition.networks.ctlplane2.network |
                       ansible.utils.ipaddr('prefix') }}'>
        </ip>
        <ip family='ipv4' address='192.168.131.1' prefix='24'/>
      </network>
    ocpbm: |
      <network>
        <name>ocpbm</name>
        <forward mode='open'/>
        <bridge name='ocpbm' stp='on' delay='0'/>
        <dns enable="no"/>
        <ip family='ipv4' address='192.168.32.1' prefix='20'/>
      </network>
    ocppr: |
      <network>
        <name>ocppr</name>
        <forward mode='bridge'/>
        <bridge name='ocppr'/>
      </network>
  vms:
    ocp:
      amount: 3
      uefi: true
      root_part_id: 4
      admin_user: core
      image_local_dir: "{{ cifmw_basedir }}/images/"
      disk_file_name: "ocp_master"
      disksize: "120"
      memory: 64
      cpus: 16
      extra_disks_num: 4
      extra_disks_size: "40G"
      nets:
        - ocppr
        - ocpbm
        - osp_trunk
    controller:
      root_part_id: "{{ cifmw_root_partition_id }}"
      image_url: "{{ cifmw_discovered_image_url }}"
      sha256_image_name: "{{ cifmw_discovered_hash }}"
      image_local_dir: "{{ cifmw_basedir }}/images/"
      disk_file_name: "base-os.qcow2"
      disksize: 50
      memory: 12
      cpus: 4
      nets:
        - ocpbm
    leaf0:
      start: false
      manage: false
      amount: 2
      disk_file_name: "blank"
      disksize: 120
      memory: 32
      cpus: 2
      nets:
        - trunk1
    leaf1:
      start: false
      manage: false
      amount: 2
      disk_file_name: "blank"
      disksize: 120
      memory: 32
      cpus: 2
      nets:
        - trunk2