Skip to content

Commit cd67359

Browse files
committed
[FIX] bugs fixed
1 parent 6c08ea2 commit cd67359

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

Ansible/keepalived/install.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,23 @@
1313
ansible.builtin.package:
1414
name: keepalived
1515
state: present
16-
when: ansible_facts['os_family'] == "RedHat"
16+
when: ansible_facts['os_family'] == "RedHat"
17+
18+
- name: Run keepalived --version and capture output
19+
ansible.builtin.command: keepalived --version
20+
register: keepalived_version
21+
changed_when: false
22+
23+
- name: Combine stdout and stderr
24+
ansible.builtin.set_fact:
25+
keepalived_version_combined: >
26+
{{ keepalived_version.stdout + keepalived_version.stderr }}
27+
28+
- name: Extract only Keepalived version
29+
ansible.builtin.set_fact:
30+
keepalived_version_only: >
31+
{{ keepalived_version_combined | regex_search('Keepalived v[0-9.]+') | default('Unknown version') }}
32+
33+
- name: Display Keepalived version
34+
ansible.builtin.debug:
35+
msg: "Keepalived version: {{ keepalived_version_only }}"

Ansible/keepalived/inventory.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
rockylinux ansible_host=142.93.56.4 ansible_user=root
33

44
[slave]
5-
debian ansible_host=157.245.130.56 ansible_user=root
6-
ubuntu ansible_host=134.209.77.220 ansible_user=root
5+
debian ansible_host=198.211.96.150 ansible_user=root
6+
ubuntu ansible_host=68.183.107.200 ansible_user=root

Ansible/keepalived/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# vars.yml
2-
interface: eth0
1+
---
2+
interface: eth1
33
virtual_router_id: 51
44
auth_pass: 1111
5-
virtual_ipaddress: 192.168.1.100
5+
virtual_ipaddress: 10.116.0.68
66
master_priority: 100
77
slave_priority: 80
88
advert_int: 1

0 commit comments

Comments
 (0)