--- - name: Add buster-backports to apt sources apt_repository: repo: deb {{ debian_mirror }} buster-backports main state: present when: - ansible_distribution == "Debian" - ansible_distribution_major_version | int == 10 - ansible_distribution_release == "buster" - name: Use buster-backports to install keepalived template: src: apt/preferences.d/keepalived.j2 dest: apt/preferences.d/keepalived owner: root group: root mode: 0644 when: - ansible_distribution == "Debian" - ansible_distribution_major_version | int == 10 - ansible_distribution_release == "buster" - name: Install keepalived apt: update_cache: true name: keepalived register: apt_result retries: 3 until: apt_result is succeeded - name: Deploy keepalived configuration template: src: keepalived/keepalived.conf.j2 dest: /etc/keepalived/keepalived.conf mode: 0644 notify: Reload keepalived.service - name: Start and enable keepalived service: name: keepalived state: started enabled: yes