98 lines
2.7 KiB
Django/Jinja
98 lines
2.7 KiB
Django/Jinja
# Generated inventory from ansible/group_vars/all.yml
|
|
;; Backup of previous file will be created when template runs.
|
|
|
|
{% set hosts_dict = lab_sot.lab_hosts | default(lab_sot.hosts | default({})) %}
|
|
|
|
# --- Watchtower (local controller) ---
|
|
[watchtower]
|
|
localhost ansible_connection=local
|
|
|
|
# --- Proxmox Cluster (management) ---
|
|
[proxmox_cluster]
|
|
{% for name,info in hosts_dict.items() %}
|
|
{% if info.get('role') == 'proxmox' %}
|
|
{% if info.current_ip is defined and info.current_ip %}
|
|
{{ name }} ansible_host={{ info.current_ip }}
|
|
{% elif info.desired_ip is string %}
|
|
{{ name }} ansible_host={{ info.desired_ip }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
[proxmox_cluster:vars]
|
|
ansible_user=chester
|
|
ansible_become=true
|
|
ansible_python_interpreter=/usr/bin/python3
|
|
|
|
# --- Swarm Managers ---
|
|
[swarm_managers]
|
|
{% for name,info in hosts_dict.items() %}
|
|
{% if 'swarm_manager' in (info.get('role')|default('')) %}
|
|
{% if info.current_ip is defined and info.current_ip %}
|
|
{{ name }} ansible_host={{ info.current_ip }}
|
|
{% elif info.desired_ip is string %}
|
|
{{ name }} ansible_host={{ info.desired_ip }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
# --- Swarm Workers ---
|
|
[swarm_workers]
|
|
{% for name,info in hosts_dict.items() %}
|
|
{% if 'swarm_worker' in (info.get('role')|default('')) %}
|
|
{% if info.current_ip is defined and info.current_ip %}
|
|
{{ name }} ansible_host={{ info.current_ip }}
|
|
{% elif info.desired_ip is string %}
|
|
{{ name }} ansible_host={{ info.desired_ip }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
# --- AI Grid ---
|
|
[ai_grid]
|
|
{% for name,info in hosts_dict.items() %}
|
|
{% if info.get('role') == 'ai_node' %}
|
|
{% if info.current_ip is defined and info.current_ip %}
|
|
{{ name }} ansible_host={{ info.current_ip }}
|
|
{% elif info.desired_ip is string %}
|
|
{{ name }} ansible_host={{ info.desired_ip }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
# --- Docker Hosts ---
|
|
[docker_hosts]
|
|
{% for name,info in hosts_dict.items() %}
|
|
{% if info.get('role') == 'docker_host' %}
|
|
{% if info.current_ip is defined and info.current_ip %}
|
|
{{ name }} ansible_host={{ info.current_ip }}
|
|
{% elif info.desired_ip is string %}
|
|
{{ name }} ansible_host={{ info.desired_ip }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
# --- Storage ---
|
|
[storage]
|
|
{% for name,info in hosts_dict.items() %}
|
|
{% if info.get('role') == 'nas' %}
|
|
{% if info.current_ip is defined and info.current_ip %}
|
|
{{ name }} ansible_host={{ info.current_ip }} ansible_scp_if_ssh=True
|
|
{% elif info.desired_ip is string %}
|
|
{{ name }} ansible_host={{ info.desired_ip }} ansible_scp_if_ssh=True
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
# --- Aggregate grouping ---
|
|
[ubuntu_lab:children]
|
|
swarm_managers
|
|
swarm_workers
|
|
ai_grid
|
|
docker_hosts
|
|
storage
|
|
|
|
[ubuntu_lab:vars]
|
|
ansible_user=chester
|
|
ansible_ssh_private_key_file=/home/chester/.ssh/id_ed25519
|