# core_provisioner_version: 0.2.8
# provisioner_name: hcl_domino_standalone_provisioner
# provisioner_version: 0.1.23
#
# Template Notes:
# This is an example Hosts.yml that is configured to install Domino 12.0.1 only.
# Instructions (paths are relative to Hosts.example.yml):
# 1. Make a copy this file as Hosts.yml
# 2. Update all `REPLACEME` entries in the file
# 3. Add your safe ID in `id-files/user-safe-ids/`
# 4. Provide installer files.  Options:
#   a. Add any local installers in `installers/domino/archives`
#   b. Enable and update domino_installer* if you want to download the artifacts instead of deploying them manually
# 5. Other optional changes:
#   a. networks - by default, this uses DHCP, but you may need to manually populate this in some cases
#   b. domino_server_installer_tar - update this and the corresponding version properties if desired
#   c. Other installers - make sure to update both the installer vars (i.e. nomadweb_*) and enable the corresponding roles (i.e. startcloud.hcl_roles.domino_nomadweb)
---
hosts:
  -
    settings:
      # Vagrant Debug
      debug_build: true

      # Identifiers
      hostname: REPLACEME #test-standalone
      domain: REPLACEME #shi.com
      server_id: REPLACEME #'1234'

      # Extra Actions
      post_provision: true ## This calls extra things after Ansible completes, like syncing the new SSH key from the lockdown role, or the id_files or the support bundle

      # Resources
      vcpus: 2
      memory: 8G

      # Console Access
      consoleport: 1234
      consolehost: 0.0.0.0
      show_console: false ## Some people have reported issues when VBox doesn't show the Console

      # Box information
      box: 'STARTcloud/debian12-server'
      box_url: 'https://boxvault.startcloud.com'
      box_version: 2025.2.9

      # Provider Specific Settings
      provider_type: virtualbox
      os_type: 'Debian_64'
      firmware_type: UEFI

      # Setup Variables
      setup_wait: 420

      # Vagrant Configurations
      vagrant_user: startcloud
      vagrant_user_pass: REPLACEME #'STARTcloud24@!'
      vagrant_user_private_key_path: ./id_rsa
      vagrant_ssh_insert_key: true
      vagrant_ssh_forward_agent: true
      vagrant_ssh_keep_alive: true

    plugins:
      install:
        -
          name: vagrant-scp-sync
          version: latest
#        -
#          name: vagrant-zones
#          version: latest
      remove:
        -
          name: vagrant-scp

    zones:
      vmtype: production
      brand: bhyve
      on_demand_vnics: true
      post_provision_boot: false
      console_onboot: false
      console: webvnc
      debug: false
      debug_boot: false
      hostbridge: i440fx
      acpi: on
      autostart: true
      setup_method: zlogin
      diskif: virtio
      netif: virtio-net-viona
      booted_string: 'Web console:'
      lcheck_string: ':~$'
      alcheck_string: 'login:'
      safe_restart: 'sudo shutdown -r'
      safe_shutdown: 'sudo init 0 || true'
      clean_shutdown_time: 200
      snapshot_script: '/opt/vagrant/bin/Snapshooter.sh'
      cpu_configuration: simple

    networks:
      # if ::NO_BRIDGE_INTERFACE::
      # TO SHI DEVs, if user wants to to disable the external bridged interface, then you should remove the below block
      -
        type: external
        address: 192.168.255.255
        netmask: 255.255.255.0
        gateway: 192.168.2.1
        autoconf: false
        vlan:
        dhcp4: true
        dhcp6: false
        is_control: false
        route: default
        provisional: false
        bridge:
        nic_type: virtio
        mac: auto
        dns:
          - nameserver: 1.1.1.1
          - nameserver: 1.0.0.1

    disks:
      boot:
        array: ignored
        dataset: ignored
        volume_name: boot
        mount: /
        size: 48G
    
      additional_disks:
      # if ::ADDITIONAL_DISK::
      # TO SHI DEVs, if user wants to store thier data on a secondary disk, you would enable this block
      #  - array: Array-1
      #    dataset: zones
      #    sparse: true
      #    live: false
      #    filesystem: xfs
      #    mount: /local
      #    size: 50.0G
      #    port: 5
      #    #driver: virtio-scsi #Only add if your template doesn't already use virtio-scsi(the new templates do)
      #    volume_name: disk1

    provisioning:
      shell:
        enabled: false
        scripts:
          - './scripts/aliases.sh'

      ansible:
        enabled: true
        playbooks:
          - local:
              -
                description: "This playbook imports Hosts.yml variables into a generated playbook: /vagrant/ansible/playbook.yml"
                playbook: ansible/generate-playbook.yml
                ansible_python_interpreter: /usr/bin/python3
                compatibility_mode: 2.0
                install_mode: pip
                ssh_pipelining: true
                verbose: false
                callbacks: profile_tasks
                run: always
                remote_collections: false
                collections: []
              -
                description: "This playbook configures the machine using the generated playbook: /vagrant/ansible/playbook.yml"
                playbook: ansible/playbook.yml
                ansible_python_interpreter: /usr/bin/python3
                compatibility_mode: 2.0
                install_mode: pip
                ssh_pipelining: true
                verbose: false
                callbacks: profile_tasks
                run: once
                remote_collections: false
                collections:
                  - startcloud.startcloud_roles
                  - startcloud.hcl_roles
              -
                description: "This playbook configures the machine for roles tagged as always, using the generated playbook: /vagrant/ansible/playbook.yml"
                playbook: ansible/always-playbook.yml
                ansible_python_interpreter: /usr/bin/python3
                compatibility_mode: 2.0
                install_mode: pip
                ssh_pipelining: true
                verbose: false
                callbacks: profile_tasks
                run: not_first
                remote_collections: false
                collections:
                  - startcloud.startcloud_roles

    folders:
      -
        description: "Disables VBoxSF, do not enable"
        map: .
        to: /vagrant
        type: virtualbox
        disabled: true
        automount: true

      -
        description: "Directory for Ansible Scripts"
        map: ./provisioners/ansible/
        to: /vagrant/ansible/
        type: rsync
        args:
          - '--verbose'
          - '--archive'
          - '--delete'
          - '-z'
          - '--copy-links'

      -
        description: "Directory for Ansible Collections"
        map: ./provisioners/ansible_collections/
        to: /vagrant/ansible_collections/
        type: rsync
        args:
          - '--verbose'
          - '--archive'
          - '--delete'
          - '-z'
          - '--copy-links'

      -
        description: "Directory for Application Installers"
        map: ./installers/
        to: /vagrant/installers/
        type: rsync

      -
        description: "Directory for Pre-Signed SSLs"
        map: ./ssls/
        to: /secure/
        type: rsync

      -
        description: "Directory for Server and User IDs"
        map: ./id-files/
        to: /id-files/
        type: rsync
        syncback: true

    vars:
      # Secrets Override: If you don't want to use a secrets file you can override secrets here
      # Uncomment and fill in these lines if you want to download the installers for this instance
      # Note that the installer names must match the names on the download server.
      #secrets:
      #  domino_installer_base_url: "replacme"
      #  domino_installer_url_user: "replaceme"
      #  domino_installer_url_pass: "replaceme"

      ## Provisioner Debug
      debug_all: true

      ## SSL
      selfsigned_enabled: true
      haproxy_ssl_redirect: true
      letsencrypt_enabled: false
      letsencrypt_staging_enabled: false

      ## Use Proxy for downloads and updates
      use_proxy: false
      proxy_server: 255.255.255.255
      proxy_port: 3128

      ## Extra Packages
      extra_packages: ['htop']

      ## Domino Configuration Variables
      #domino_server_name: "DoMiNO-iS-dVMb" # Defaults to settings.hostname if not set
      #domino_server_domain: "some-domino-org-different-than-vms-domain.tld" # Defaults to settings.domain if not set
      domino_organization: REPLACEME # TESTSTANDALONE
      #domino_admin_notes_id_password: password

      domino_oidc_debug: true

      #domino_oidc_external_providers:
      #  - name: null
      #    base_url: null
      #    client_id: null
      #    client_secret: null

      ## Safe-ids to cross-certify (only works for initial/standalone server)
      # You need to add a file matching this name to id-files/user-safe-ids
      user_safe_id: REPLACEME #safe.ids

      ## Additional server options
      is_additional_server: false
      #domino_server_id: "additional-demo.startcloud.com.id"
      #origin_server: "standalone-demo.startcloud.com"
      #origin_server_ip: "192.168.2.255"

      # ots: Use One Touch Setup to generate the ID (server names are incremented, ie mail1 mail2 mail3 . .)
      # asja: Use Custom Additional Server Java Applet to generate the additional server ID
      #domino_server_id_creation_tool: asja

      ## OTS Additional Server Settings
      # For use in Domino 14 and above, uncomment out these and set as needed
      #ots_generate_server_names:
      #  - additional-demo.startcloud.com
      #  - ADDITIONAL-demo.startcloud.com
      
      # For use in Domino 12 and below
      #ots_generate_server_id_count:  1
      #ots_generate_server_id_pattern: mail

      ## ASJA Server Settings
      # If using ASJA instead of OTS to generated Server IDs uncomment these lines
      #asja_generate_server_ids:
      #  - name: additional-demo.startcloud.com
      #    pass: ""

      ## Genesis Variables
      genesis_packages:
        - netmonitor
        - SuperHumanPortal

      ## Domino Installer Variables
      #domino_hash: 
      # REPLACEME:   Update Domino installer and version if needed, and update the versions as well
      # If you want to use a local copy, it must match the below name and be added to `./installers/domino/archives`
      domino_server_installer_tar: Domino_14.5_Linux_English_EA2.tar #Domino_14.0_Linux_English.tar
      domino_major_version: 14
      domino_minor_version: 5
      domino_patch_version: 0

      ## Domino fixpack Variables
      #domino_fp_hash: 
      domino_installer_fixpack_install: false
      domino_fixpack_version:
      domino_server_fixpack_tar:

      ## Domino Hotfix Variables
      #domino_hf_hash:
      domino_installer_hotfix_install: false
      domino_hotfix_version:
      domino_server_hotfix_tar:

      ## Jedi Overrides
      jedi_enabled: true ## If you prefer Nashed Domino Management, but want to have Jedi Installed, set this to False, otherwise if you want Jedi to manage domino, set this to true

      ## Leap Variables
      #leap_hash:
      #leap_archive:
      #leap_version:

      ## Nomad Web Variables
      #nomadweb_hash:
      #nomadweb_archive:
      #nomadweb_version: 
      #nomad_hotfix_version: "HF1"
      #nomad_hotfix_install: false

      ## Traveler Variables
      #traveler_hash: ::TRAVELER_HASH::
      #traveler_archive:
      #traveler_base_version:
      #traveler_fixpack_install: false
      #traveler_fixpack_archive:
      #traveler_fixpack_version:

      ## Verse Variables
      #verse_hash: ::VERSE_HASH::
      #verse_archive:
      #verse_base_version:

      ## AppDev Web Pack Variables ## Will receive no Updates in the future
      #appdevpack_hash: ::APPDEVPACK_HASH::
      #appdevpack_archive:
      #appdevpack_version:

      ## Domino Rest API Variables
      #domino_rest_api_hash: ::DOMINO_REST_API_HASH::
      #domino_rest_api_version:
      #domino_rest_api_archive:

      ## Hosts entries for /etc/hosts
      #etc_hosts_entries:
      #  - hostname: "{{ settings.hostname }}.{{ settings.domain }}"
      #    aliases:
      #      - "{{ settings.hostname }}"
      #      - "{{ domino_server_name }}.{{ domino_server_domain }}"
      #      - "{{ domino_server_name }}"
      #    ip: 192.168.2.255

    roles:
      - name: startcloud.startcloud_roles.setup
      - name: startcloud.startcloud_roles.networking
        tags: always
      - name: startcloud.startcloud_roles.disks
      - name: startcloud.startcloud_roles.hostname
      - name: startcloud.startcloud_roles.dependencies
      - name: startcloud.startcloud_roles.mdns
      - name: startcloud.startcloud_roles.service_user
      - name: startcloud.startcloud_roles.sdkman_install
      - name: startcloud.startcloud_roles.sdkman_java
      - name: startcloud.startcloud_roles.sdkman_maven
      - name: startcloud.startcloud_roles.sdkman_gradle
      - name: startcloud.startcloud_roles.ssl
      - name: startcloud.hcl_roles.domino_reset
        vars:
          run_tasks: false
      - name: startcloud.hcl_roles.domino_install
      - name: startcloud.hcl_roles.domino_vagrant_rest_api
      - name: startcloud.hcl_roles.domino_service_nash
      - name: startcloud.hcl_roles.domino_java_config
      - name: startcloud.hcl_roles.domino_java_tools
      - name: startcloud.hcl_roles.domino_updatesite
      - name: startcloud.hcl_roles.domino_config 
      - name: startcloud.hcl_roles.domino_genesis
      - name: startcloud.hcl_roles.domino_genesis_applications
      - name: startcloud.hcl_roles.domino_cross_certify
      - name: startcloud.hcl_roles.domino_java_app_example
        vars:
          run_tasks: true
      - name: startcloud.hcl_roles.domino_oidc
        vars:
          run_tasks: true
      - name: startcloud.hcl_roles.domino_leap
        vars:
          run_tasks: false
      - name: startcloud.hcl_roles.domino_traveler
        vars:
          run_tasks: false
      - name: startcloud.hcl_roles.domino_traveler_htmo
        vars:
          run_tasks: false
      - name: startcloud.hcl_roles.domino_verse
        vars:
          run_tasks: false
      # Deprecated -- See: https://support.hcl-software.com/csm?id=kb_article&sysparm_article=KB0105781
      - name: startcloud.hcl_roles.domino_appdevpack
        vars:
          run_tasks: false
      - name: startcloud.hcl_roles.domino_rest_api
        vars:
          run_tasks: false
      - name: startcloud.hcl_roles.domino_nomadweb
        vars:
          run_tasks: false
      - name: startcloud.hcl_roles.domino_jedi
        vars:
          run_tasks: true
      - name: startcloud.hcl_roles.domino_vagrant_readme
        vars:
          run_tasks: true
      - name: startcloud.startcloud_roles.quick_start
        tags: always
        vars:
          run_tasks: true
      - name: startcloud.startcloud_roles.haproxy
        vars:
          run_tasks: true
      - name: startcloud.startcloud_roles.vagrant_readme
        vars:
          run_tasks: true
      - name: startcloud.startcloud_roles.lockdown
        vars:
          run_tasks: true
