---
- name: Check for existing wolfstack installation
  ansible.builtin.command: which wolfstack
  register: wolfstack_exists
  ignore_errors: true
  changed_when: false

- name: Run Wolfstack installer
  ansible.builtin.shell: |
    curl -sSL https://raw.githubusercontent.com/wolfsoftwaresystemsltd/WolfStack/master/setup.sh | bash
  args:
    executable: /bin/bash
  when: wolfstack_exists.rc != 0

- name: Ensure wolfstack service is running and enabled
  ansible.builtin.systemd:
    name: wolfstack
    state: started
    enabled: true
    daemon_reload: true

- name: Install keepalived package
  ansible.builtin.apt:
    name: keepalived
    state: present
    update_cache: true
  when: ansible_os_family == "Debian"
