#
# 
# Automated installation for vaultwarden
# 
# 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: 144
    lxc_name: vaultwarden
    lxc_domain: leh01.local
    lxc_template: "local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst"
    lxc_mac: CC:CC:CC:18:01:81
    lxc_bridge: vmbr180
    lxc_vlan: ""
    lxc_disk: datapool:20
    lxc_cpu: 2
    lxc_memory: 4096
    lxc_swap: 4192
    lxc_ssh_pub_key: ~/.ssh/id_ed25519_ansible.pub
  roles:
    - lxc-container

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

- hosts: "vaultwarden"
  tags: 
    - vaultwarden
    - install
  vars:
    service_name: vaultwarden
    service_directory: /opt/vaultwarden
    service_volume_dirs:
      - appdata
    service_user_name: vaultwarden
    service_user_id: 1090
    service_group_name: vaultwarden
    service_group_id: 1090    
    bankmanager_version: latest
  tasks:
    - name: "Install vaultwarden application"
      include_tasks: setup-docker-application.yml