Skip to content

Commit 97b26f9

Browse files
Normotobiashuste
authored andcommitted
keepalived role: use validate parameter to check config file
Signed-off-by: Norman Ziegner <n.ziegner@hzdr.de>
1 parent 2694ffd commit 97b26f9

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)