info:
  summary: JFT - using kanku with vagrant boxes
  description: |+
               FIXME - detailed description required

domain_name: vagranku-host
default_job: vagrant-ansible
login_user: root
login_pass: kankudai

jobs:
 vagrant-ansible:
  -
    use_module: Kanku::Handler::SetJobContext
    options:
      host_interface: eth0
  -
    use_module: Kanku::Handler::OBSCheck
    options:
      project: devel:kanku:images
      package: openSUSE-Tumbleweed-JeOS:ext4
      repository: images_tumbleweed
  -
    use_module: Kanku::Handler::ImageDownload
  -
    use_module: Kanku::Handler::CreateDomain
    options:
      memory: 6G
      vcpu: 2
      use_9p: 1
  -
    use_module: Kanku::Handler::PrepareSSH
  # Kanku::Handler::CopyProfile configuration in kanku-config.yml required
  -
    use_module: Kanku::Handler::CopyProfile
  -
    use_module: Kanku::Handler::ExecuteCommandViaSSH
    options:
      commands:
        - ls -la /home/ >> /tmp/perms.log
        - zypper ar obs://devel:kanku:staging dks
        - zypper --gpg-auto-import-keys ref -s
        - zypper -n in kanku-cli make ansible qemu-spice
        - ls -la /home/ >> /tmp/perms.log
        - kanku setup devel --user kanku
        - ls -la /home/ >> /tmp/perms.log
        - "chown kanku -R /home/kanku/.ssh"
        - ls -la /home/ >> /tmp/perms.log
        # FIXME:
        # This workaround ugly and insecure but ATM required
        # The vagrant images do not register their hostname properly
        # in the dhcp/dns server and are unresolvable without this hack
        - chmod 666 /etc/hosts
  -
    use_module: Kanku::Handler::ExecuteCommandViaSSH
    options:
      username: kanku
      commands:
        - ssh-keygen -N "" -f .ssh/id_ed25519
        - kanku init -T vagrant -d vagranku-guest
        - perl -p -i -e 's#\s+- echo "Just testing ssh connection"#  - !include guest.d/run_ansible.yml#' KankuFile
        - eval `ssh-agent`;ssh-add;kanku up --skip_all_checks
  -
    use_module: Kanku::Handler::ExecuteCommandViaSSH
    options:
      commands:
        - chmod 644 /etc/hosts
