- hosts: "leh01"
  name: Create container
  vars:
    lxc_id: 130
    lxc_name: timescaledb
    lxc_domain: leh01.local
    lxc_template: "local:vztmpl/debian-12-standard_12.2-1_amd64.tar.zst"
    lxc_mac: CC:CC:CC:15:01:30
    lxc_ip: 192.168.150.130
    lxc_bridge: vmbr150
    lxc_vlan: ""
    lxc_disk: datapool:32
    lxc_cpu: 2
    lxc_memory: 2048
    lxc_swap: 1024
    lxc_mounts: '{"mp0":"lxc-nodered-datalogger:100,mp=/opt/nodered-datalogger"}'
    lxc_ssh_pub_key: ~/.ssh/id_ed25519_ansible.pub
  roles:
    - lxc-container

- hosts: "timescaledb" 
  vars:    
    hostname: timescaledb
    lxc_ip: 192.168.150.130
    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

- hosts: "timescaledb" 
  vars:    
    hostname: timescaledb
    lxc_ip: 192.168.150.130
    tools_install_users:
      - root     
      - ansible    
  tasks:
    - import_tasks: "../roles/common/tasks/common.yml"

- hosts: "timescaledb"
  vars:    
    lxc_ip: 192.168.150.130
    postgresql_admin_password: captica
    postgresql_allowed_hosts: 
      - '0.0.0.0/0'
    timescaledb_database_name: datalogger
    timescaledb_database_schema: captica
    timescaledb_database_user: captica
    timescaledb_database_password: captica
    tools_install_users:
      - ansible
      - root
  roles:
    - timescaledb

- hosts: "timescaledb"
  vars:    
    lxc_ip: 192.168.150.130
    postgresql_version: 16
    postgresql_admin_password: captica
    postgresql_allowed_hosts: 
      - '0.0.0.0/0'
    timescaledb_database_name: datalogger
    timescaledb_database_schema: captica
    timescaledb_database_user: captica
    timescaledb_database_password: captica
    tools_install_users:
      - ansible
      - root
  tasks:
    - import_tasks: "../roles/common/tasks/postgres_cron.yml"