Files
ansible-pull-deploy/local.yml

95 lines
2.7 KiB
YAML

---
- hosts: localhost
connection: local
become: true
tasks:
# Load host-specific vars by actual system hostname
- name: Load host-specific variables
include_vars:
file: "host_vars/{{ ansible_hostname | lower }}.yml"
ignore_errors: true
tags: [vars, always]
- name: Print start message
debug:
msg: "Ansible Pull running on {{ ansible_hostname }} ({{ inventory_hostname }}) — role: {{ node_type | default('unspecified') }}"
# --- ALL NODES: baseline ---
- name: Ensure apt packages are updated
apt:
update_cache: yes
cache_valid_time: 3600
when: ansible_os_family == "Debian"
tags: [baseline]
- name: Ensure common packages installed
apt:
name:
- curl
- git
- htop
- tmux
- jq
- vim
- python3-pip
state: present
when: ansible_os_family == "Debian"
tags: [baseline]
# --- NODE-SPECIFIC: extra packages ---
- name: Ensure node-specific extra packages installed
apt:
name: "{{ extra_packages }}"
state: present
when:
- ansible_os_family == "Debian"
- extra_packages is defined
- extra_packages | length > 0
tags: [node_specific]
# --- NODE-SPECIFIC: Ollama model management ---
- name: Ensure Ollama is installed
command: which ollama
register: ollama_check
ignore_errors: true
changed_when: false
tags: [ollama]
- name: Pull node-specific Ollama models
command: "ollama pull {{ item }}"
loop: "{{ ollama_models }}"
when:
- ollama_check.rc == 0
- ollama_models is defined
- ollama_models | length > 0
register: ollama_pull_result
tags: [ollama]
# --- NODE-SPECIFIC: Service management (placeholder) ---
- name: Ensure managed services are enabled
systemd:
name: "{{ item.name }}"
enabled: "{{ item.enabled | default(true) }}"
loop: "{{ managed_services }}"
when:
- managed_services is defined
- managed_services | length > 0
ignore_errors: true
tags: [services]
# --- Artemis-specific: monitoring dashboard ---
- name: Ensure Artemis cockpit available
apt:
name:
- cockpit
- cockpit-pcp
state: present
when:
- inventory_hostname == "artemis.ai.home" or ansible_hostname == "artemis"
- ansible_os_family == "Debian"
tags: [artemis]
- name: Print completion message
debug:
msg: "Baseline complete on {{ ansible_hostname }} — node_type={{ node_type | default('unspecified') }}, gpu={{ has_gpu | default(false) }}"