mirror of
https://gitea.0xace.cc/ansible-galaxy/keepalived.git
synced 2025-06-28 18:03:08 +00:00
initial commit
This commit is contained in:
35
tasks/main.yml
Normal file
35
tasks/main.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: Install keepalived
|
||||
package:
|
||||
name: keepalived
|
||||
state: present
|
||||
register: keepalived_setup
|
||||
|
||||
- block:
|
||||
- name: Merge config for keepalived
|
||||
set_fact:
|
||||
keepalived_config: "{{ keepalived_default_config | combine(keepalived_config, recursive=true) }}"
|
||||
|
||||
- name: Add keepalived config
|
||||
template:
|
||||
src: "keepalived.conf.j2"
|
||||
dest: "/etc/keepalived/keepalived.conf"
|
||||
notify:
|
||||
- Restart keepalived
|
||||
when: not keepalived_config_override
|
||||
|
||||
- name: Override keepalived config
|
||||
copy:
|
||||
content: "{{ keepalived_config_override }}"
|
||||
dest: "/etc/keepalived/keepalived.conf"
|
||||
notify:
|
||||
- Restart keepalived
|
||||
when: keepalived_config_override
|
||||
|
||||
- name: Enable and start keepalived service
|
||||
systemd:
|
||||
name: keepalived
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
register: keepalived_enable_and_start
|
Reference in New Issue
Block a user