---
- name: Install keepalived
  apt:
    name: keepalived
    state: present
    update_cache: yes

- name: Create keepalived config
  template:
    src: keepalived.conf.j2
    dest: /etc/keepalived/keepalived.conf
    mode: "0644"
  notify: restart keepalived

- name: Enable and start keepalived
  systemd:
    name: keepalived
    enabled: yes
    state: started
