---
<%
    require 'dotenv'
    Dotenv.load
%>

driver:
  <% if ENV['KITCHEN_DRIVER'] == 'ec2' %>
  name: ec2
  associate_public_ip: false
  instance_type: <%= ENV['EC2_INSTANCE_TYPE'] || 't3.medium' %>
  interface: private
  region: <%= ENV['AWS_REGION'] || 'us-east-1' %>
  security_group_filter:
    name: <%= ENV['EC2_SECURITY_GROUP_NAME'] || 'dev-test-kitchen-instance-security-group' %>
  subnet_filter:
    tag: Name
    value: <%= ENV['EC2_SUBNET_NAME'] || 'private01' %>
  # These aren't strictly required, but are useful for bootstrapping a functional Ceph cluster from the Test Kitchen instance(s)
  block_device_mappings:
    - device_name: /dev/sdf
      ebs:
        volume_type: gp3
        volume_size: 20
        delete_on_termination: true
    - device_name: /dev/sdg
      ebs:
        volume_type: gp3
        volume_size: 20
        delete_on_termination: true
    - device_name: /dev/sdh
      ebs:
        volume_type: gp3
        volume_size: 20
        delete_on_termination: true
  <% elsif ENV['KITCHEN_DRIVER'] == 'vcenter' %>
  name: vcenter
  cluster: prod-t1-esx-cluster
  template: debian-11-template
  datacenter: "AVL-Datacenter01"
  vcenter_username: <%= ENV['VCENTER_USER'] %>
  vcenter_password: "<%= ENV['VCENTER_PASSWORD'] %>"
  vcenter_host: 'vsphere02.avl.theorchard'
  vcenter_disable_ssl_verify: true
  vm_wait_timeout: 300
  networks:
    - name: Vector Storage iSCSI Network 1
      operation: add
# Can't use multiple networks due to bug with kitchen-vcenter
#    - name: Vector Storage iSCSI Network 2
#      operation: add
  vm_customization:
    numCPUs: 2
    memoryMB: 8192
    annotation: 'irrigate-ceph test kitchen VM'
  <% end %>

<% if ENV['KITCHEN_DRIVER'] == 'vcenter' %>
transport:
  username: <%= ENV['VCENTER_SSH_USER'] %>
  ssh_key: <%= ENV['VCENTER_SSH_KEY'] %>
<% end %>

provisioner:
  name: chef_zero
  product_name: chef
  product_version: 18.2.7
  chef_license: accept

verifier:
  name: inspec

platforms:
  - name: debian-11
    run_list:
      - recipe[irrigate-ceph::default]
    <% if ENV['KITCHEN_DRIVER'] == 'vcenter' %>
      - recipe[irrigate-ceph::networking]
      - recipe[irrigate-ceph::iscsi]
      - recipe[irrigate-ceph::lvm]
    <% end %>
    lifecycle:
      post_create:
        - remote: sudo apt update
        - remote: "sudo apt upgrade -y"
    attributes:
      ceph:
        ssh:
          public_key: <%= ENV['CEPH_SSH_PUBLIC_KEY'] %>
        <% if ENV['KITCHEN_DRIVER'] == 'vcenter' %>
        iscsi:
          initiator_name: iqn.1993-08.org.debian:01:prod-ceph-development
          portals:
            - 10.10.90.9
            - 10.10.90.10
          interfaces:
            ens224:
              ip_address: 10.10.90.76
              netmask: 255.255.255.0
        lvm:
          pvs:
            - /dev/mapper/mpatha
          vgs:
            vg0:
              pvs:
                - /dev/mapper/mpatha
              lvs:
                lv0:
                  size: 100%FREE
        <% end %>
    verifier:
      inspec_tests:
        - test/integration/default
        <% if ENV['KITCHEN_DRIVER'] == 'vcenter' %>
        - test/integration/iscsi
        <% end %>

suites:
  - name: default
<% (1...(ENV['ADDITIONAL_HOST_COUNT'].to_i + 1)).each do |index| %>
  - name: host<%= index %>
<% end %>
