30 lines
738 B
YAML
30 lines
738 B
YAML
---
|
|
- name: Install & Configure Keepalived VIP
|
|
hosts: rpis
|
|
remote_user: root
|
|
become: True
|
|
|
|
tasks:
|
|
- name: Update APT-cache if Debianbased
|
|
apt: update_cache=yes cache_valid_time=3600
|
|
when: ansible_os_family == 'Debian'
|
|
- name: Install keepalived
|
|
package:
|
|
name: keepalived
|
|
state: latest
|
|
- name: Configure keepalived
|
|
template:
|
|
src: /srv/ansible/files/templates/keepalived/keepalived.conf.j2
|
|
dest: /etc/keepalived/keepalived.conf
|
|
register: template
|
|
- name: Restart keepalive Server
|
|
service:
|
|
name: keepalived
|
|
state: restarted
|
|
when: template.changed
|
|
- name: Running keepalive Server
|
|
service:
|
|
name: keepalived
|
|
state: started
|
|
enabled: yes
|
|
... |