Skip to content

Commit bd179e3

Browse files
authored
Merge pull request #472 from Normo/keepalived-config-validate
Use validate parameter to check Keepalived config file
2 parents 2694ffd + 97b26f9 commit bd179e3

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

roles/keepalived/tasks/main.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,9 @@
138138
owner: "root"
139139
group: "root"
140140
mode: "0644"
141+
validate: "{{ __keepalived_binary.stat.exists | ternary(keepalived_executable_path ~ ' --config-test --use-file %s', omit) }}"
141142
notify: "Reload Keepalived"
142143

143-
- name: "Verify Keepalived configuration."
144-
become: true
145-
ansible.builtin.command:
146-
cmd: "{{ keepalived_executable_path | quote }} --config-test --use-file {{ keepalived_conf_file_path | quote }}"
147-
register: "__config_check"
148-
changed_when: "__config_check.rc != 0"
149-
150144
- name: "Create Keepalived Service Unit File."
151145
ansible.builtin.template:
152146
src: "{{ keepalived_service_template }}"

0 commit comments

Comments
 (0)