Files
spinifex/scripts/ansible/roles/install/tasks/main.yml
T
Josh Siviour b7dea45ee0 feat: Ansible dev lifecycle (parallel to bash scripts) (#178)
Playbooks for preflight / teardown / install / reset covering the same
ground as dev-install.sh, dev-setup.sh, reset-dev-env.sh. Existing bash
scripts untouched — decide which to keep after parity testing.

- roles/teardown + teardown catalog README track every known state
  source; add a task + row when a leak is reported.
- roles/init gates smoketest on awsgw readiness (describe-regions poll).
- roles/smoketest is dup-tolerant, retry-wrapped, auto-terminates the
  launched instance.
- dev-install.yml skips build/install/init when a healthy environment
  is already present (4-signal health check), always runs smoketest.
- dev-reset.yml captures region/az/external-mode scalars from the
  existing spinifex.toml and replays them into init.

Plan: docs/development/improvements/ansible-dev-lifecycle.md (mulga).
Bead: mulga-siv-9.
2026-05-01 10:04:37 +10:00

66 lines
2.0 KiB
YAML

---
- name: install — assert tarball exists
ansible.builtin.stat:
path: "{{ build_tarball_path }}"
register: install_tarball
- name: install — fail if tarball missing
ansible.builtin.assert:
that: install_tarball.stat.exists
fail_msg: "Tarball {{ build_tarball_path }} missing. Run the build role first."
- name: install — stop spinifex.target before reinstall
become: true
ansible.builtin.systemd:
name: spinifex.target
state: stopped
failed_when: false
- name: install — reset failed state (spinifex-* scope)
become: true
ansible.builtin.command: systemctl reset-failed 'spinifex-*'
changed_when: false
failed_when: false
- name: install — scrub stale pid/log files from prior dev-mode installs
become: true
ansible.builtin.shell: |
for dir in {{ spinifex_data_dir }} {{ spinifex_log_dir }} {{ spinifex_etc_dir }}; do
if [ -d "$dir" ]; then
find "$dir" -name '*.pid' -delete 2>/dev/null || true
find "$dir" -name '*.log' -delete 2>/dev/null || true
find "$dir" -name '*.log.*' -delete 2>/dev/null || true
fi
done
changed_when: false
- name: install — remove legacy /var/lib/spinifex/config
become: true
ansible.builtin.file:
path: "{{ spinifex_data_dir }}/config"
state: absent
- name: install — run setup.sh (creates users, dirs, systemd units)
become: true
ansible.builtin.command:
cmd: "bash {{ spinifex_root }}/scripts/setup.sh"
environment:
INSTALL_SPINIFEX_TARBALL: "{{ build_tarball_path }}"
INSTALL_SPINIFEX_SKIP_NEWGRP: "1"
changed_when: true
- name: install — cleanup tarball
ansible.builtin.file:
path: "{{ build_tarball_path }}"
state: absent
- name: install — run setup-ovn.sh --management
become: true
ansible.builtin.command:
cmd: /usr/local/share/spinifex/setup-ovn.sh --management
changed_when: true
- name: install — summary
ansible.builtin.debug:
msg: "Install complete — setup.sh + setup-ovn.sh ran. Services NOT yet started (init role handles that)."