#
# 
# Automated installation for bankmanager
# 
# Project: playbooks
# Author: Tobias Lehmann <tobias.lehmann@captica.de>
# License: MIT License (see LICENSE.md)
# 
# Copyright (c) captica GmbH est. 2021
#
- hosts: "leh01"
  name: Create container
  vars:
    lxc_id: 1035
    lxc_name: harvester
    lxc_domain: leh01.local
    lxc_template: "local:vztmpl/debian-12-standard_12.2-1_amd64.tar.zst"
    lxc_mac: CC:CC:CC:15:01:75
    lxc_bridge: vmbr150
    lxc_vlan: ""
    lxc_disk: datapool:32
    lxc_cpu: 2
    lxc_memory: 2048
    lxc_swap: 1024
    lxc_mounts: '{"mp0":"lxc-harvester:50,mp=/opt/harvester"}'
    lxc_ssh_pub_key: ~/.ssh/id_ed25519_ansible.pub
  roles:
    - lxc-container

- hosts: "harvester" 
  vars:    
    hostname: harvester
    tools_install_users:
      - root     
      - ansible
    ssh_pubkeys_root:
      - "../files/ssh/root.pub"
    ssh_pubkeys_ansible:
      - "../files/ssh/id_ed25519_ansible.pub"
  roles: 
    - linux-base-install
    - zsh
    - vim
    - fzf
    - linux-docker

- hosts: "harvester"
  tags: 
    - harvester
    - install
  vars:
    service_name: harvester
    service_directory: /opt/harvester
    service_volume_dirs:
      - appdata
      - db
    service_user_name: harvester
    service_user_id: 1020
    service_group_name: harvester
    service_group_id: 1020    
    harvester_version: latest
  tasks:
    - name: "Install harvester application"
      include_tasks: setup-docker-application.yml