1.keepalived-master playbook
[root@ansible-server ansible]
[root@ansible-server ansible]
[root@ansible-server keepalived-master]
[root@ansible-server keepalived-master]
[root@ansible-server keepalived-master]
URL: mirrors.cloud.tencent.com
ROCKY_URL: mirrors.sjtug.sjtu.edu.cn
KEEPALIVED_FILE: keepalived-2.2.4.tar.gz
SRC_DIR: /usr/local/src
KEEPALIVED_INSTALL_DIR: /apps/keepalived
STATE: MASTER
PRIORITY: 100
VIP: 172.31.0.188
[root@ansible-server keepalived-master]
[root@ansible-server keepalived-master]
[PowerTools]
name=PowerTools
{
% if ansible_distribution =="Rocky" %}
baseurl=https://{
{
ROCKY_URL }}/rocky/$releasever/PowerTools/$basearch/os/
{
% elif ansible_distribution=="CentOS" %}
baseurl=https://{
{
URL }}/centos/$releasever/PowerTools/$basearch/os/
{
% endif %}
gpgcheck=1
{
% if ansible_distribution =="Rocky" %}
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
{
% elif ansible_distribution=="CentOS" %}
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
{
% endif %}
[root@ansible-server keepalived-master]
! Configuration File for keepalived
global_defs {
notification_email {
acassen
}
notification_email_from [email protected]
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state {
{
STATE }}
interface {
{
ansible_default_ipv4.interface }}
garp_master_delay 10
smtp_alert
virtual_router_id 51
priority {
{
PRIORITY }}
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
{
{
VIP }} dev {
{
ansible_default_ipv4.interface }} label {
{
ansible_default_ipv4.interface }}:1
}
}
[root@ansible-server keepalived-master]
---
- hosts: all
vars_files:
vars.yml
tasks:
- name: find "[PowerTools]" mirror warehouse
find:
path: /etc/yum.repos.d/
contains: '\[PowerTools\]'
register: RETURN
when:
- (ansible_distribution=="CentOS" or ansible_distribution=="Rocky")
- ansible_distribution_major_version=="8"
- name: copy repo file
template:
src: PowerTools.repo.j2
dest: /etc/yum.repos.d/PowerTools.repo
when:
- (ansible_distribution=="CentOS" or ansible_distribution=="Rocky") and (ansible_distribution_major_version=="8")
- RETURN.matched == 0
- name: install CentOS8 or Rocky8 depend on the package
yum:
name: make,gcc,ipvsadm,autoconf,automake,openssl-devel,libnl3-devel,iptables-devel,ipset-devel,file-devel,net-snmp-devel,glib2-devel,pcre2-devel,libnftnl-devel,libmnl-devel,systemd-devel
when:
- (ansible_distribution=="CentOS" or ansible_distribution=="Rocky")
- ansible_distribution_major_version=="8"
- name: install CentOS7 depend on the package
yum:
name: make,gcc,libnfnetlink-devel,libnfnetlink,ipvsadm,libnl,libnl-devel,libnl3,libnl3-devel,lm_sensors-libs,net-snmp-agent-libs,net-snmp-libs,openssh-server,openssh-clients,openssl,openssl-devel,automake,iproute
when:
- ansible_distribution=="CentOS"
- ansible_distribution_major_version=="7"
- name: delete lock files
file:
path: "{
{ item }}"
state: absent
loop:
- /var/lib/dpkg/lock
- /var/lib/apt/lists/lock
- /var/cache/apt/archives/lock
when:
- ansible_distribution=="Ubuntu"
- name: apt update
apt:
update_cache: yes
force: yes
when:
- ansible_distribution=="Ubuntu"
- name: install Ubuntu 20.04 depend on the package
apt:
name: make,gcc,ipvsadm,build-essential,pkg-config,automake,autoconf,libipset-dev,libnl-3-dev,libnl-genl-3-dev,libssl-dev,libxtables-dev,libip4tc-dev,libip6tc-dev,libipset-dev,libmagic-dev,libsnmp-dev,libglib2.0-dev,libpcre2-dev,libnftnl-dev,libmnl-dev,libsystemd-dev
force: yes
when:
- ansible_distribution=="Ubuntu"
- ansible_distribution_major_version=="20"
- name: install Ubuntu 18.04 depend on the package
apt:
name: make,gcc,ipvsadm,build-essential,pkg-config,automake,autoconf,iptables-dev,libipset-dev,libnl-3-dev,libnl-genl-3-dev,libssl-dev,libxtables-dev,libip4tc-dev,libip6tc-dev,libipset-dev,libmagic-dev,libsnmp-dev,libglib2.0-dev,libpcre2-dev,libnftnl-dev,libmnl-dev,libsystemd-dev
force: yes
when:
- ansible_distribution=="Ubuntu"
- ansible_distribution_major_version=="18"
- name: unarchive keepalived package
unarchive:
src: "{
{ KEEPALIVED_FILE }}"
dest: "{
{ SRC_DIR }}"
- name: get KEEPALIVED_DIR directory
shell:
cmd: echo {
{
KEEPALIVED_FILE }} | sed -nr 's/^(.*[0-9]).([[:lower:]]).*/\1/p'
register: KEEPALIVED_DIR
- name: Build and install Keepalived
shell:
chdir: "{
{ SRC_DIR }}/{
{ KEEPALIVED_DIR.stdout }}"
cmd: ./configure --prefix={
{
KEEPALIVED_INSTALL_DIR }} --disable-fwmark
- name: make && make install
shell:
chdir: "{
{ SRC_DIR }}/{
{ KEEPALIVED_DIR.stdout }}"
cmd: make -j {
{
ansible_processor_vcpus }} && make install
- name: create /etc/keepalived directory
file:
path: /etc/keepalived
state: directory
- name: copy keepalived.conf file
template:
src: keepalived.conf.j2
dest: /etc/keepalived/keepalived.conf
- name: copy keepalived.service file
copy:
remote_src: True
src: "{
{ SRC_DIR }}/{
{ KEEPALIVED_DIR.stdout }}/keepalived/keepalived.service"
dest: /lib/systemd/system/
- name: PATH variable
copy:
content: 'PATH={
{ KEEPALIVED_INSTALL_DIR }}/sbin:$PATH'
dest: /etc/profile.d/keepalived.sh
- name: PATH variable entry
shell:
cmd: . /etc/profile.d/keepalived.sh
- name: start keepalived
systemd:
name: keepalived
state: started
enabled: yes
daemon_reload: yes
[root@ansible-server keepalived-master]
[root@ansible-server ansible]
PLAY [all] ************************************************************************************************************************************
TASK [Gathering Facts] ************************************************************************************************************************
ok: [172.31.0.103]
ok: [172.31.0.101]
ok: [172.31.0.102]
ok: [172.31.0.105]
ok: [172.31.0.104]
TASK [find "[PowerTools]" mirror warehouse] ***************************************************************************************************
skipping: [172.31.0.103]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
ok: [172.31.0.101]
ok: [172.31.0.102]
TASK [copy repo file] *************************************************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.103]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
TASK [install CentOS8 or Rocky8 depend on the package] ****************************************************************************************
skipping: [172.31.0.103]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
changed: [172.31.0.101]
changed: [172.31.0.102]
TASK [install CentOS7 depend on the package] **************************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
changed: [172.31.0.103]
TASK [delete lock files] **********************************************************************************************************************
skipping: [172.31.0.101] => (item=/var/lib/dpkg/lock)
skipping: [172.31.0.101] => (item=/var/lib/apt/lists/lock)
skipping: [172.31.0.101] => (item=/var/cache/apt/archives/lock)
skipping: [172.31.0.102] => (item=/var/lib/dpkg/lock)
skipping: [172.31.0.102] => (item=/var/lib/apt/lists/lock)
skipping: [172.31.0.102] => (item=/var/cache/apt/archives/lock)
skipping: [172.31.0.103] => (item=/var/lib/dpkg/lock)
skipping: [172.31.0.103] => (item=/var/lib/apt/lists/lock)
skipping: [172.31.0.103] => (item=/var/cache/apt/archives/lock)
ok: [172.31.0.104] => (item=/var/lib/dpkg/lock)
changed: [172.31.0.105] => (item=/var/lib/dpkg/lock)
changed: [172.31.0.105] => (item=/var/lib/apt/lists/lock)
changed: [172.31.0.104] => (item=/var/lib/apt/lists/lock)
ok: [172.31.0.104] => (item=/var/cache/apt/archives/lock)
changed: [172.31.0.105] => (item=/var/cache/apt/archives/lock)
TASK [apt update] *****************************************************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.105]
TASK [install Ubuntu 20.04 depend on the package] *********************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.103]
skipping: [172.31.0.102]
skipping: [172.31.0.104]
changed: [172.31.0.105]
TASK [install Ubuntu 18.04 depend on the package] *********************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.103]
skipping: [172.31.0.105]
changed: [172.31.0.104]
TASK [unarchive keepalived package] **********************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.101]
changed: [172.31.0.102]
changed: [172.31.0.104]
changed: [172.31.0.105]
TASK [get KEEPALIVED_DIR directory] ***********************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.105]
changed: [172.31.0.104]
changed: [172.31.0.101]
changed: [172.31.0.102]
TASK [Build and install Keepalived] ***********************************************************************************************************
changed: [172.31.0.104]
changed: [172.31.0.103]
changed: [172.31.0.102]
changed: [172.31.0.105]
changed: [172.31.0.101]
TASK [make && make install] *******************************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.101]
changed: [172.31.0.102]
changed: [172.31.0.105]
TASK [create /etc/keepalived directory] *******************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.101]
changed: [172.31.0.102]
changed: [172.31.0.105]
TASK [copy keepalived.conf file] **************************************************************************************************************
changed: [172.31.0.105]
changed: [172.31.0.104]
changed: [172.31.0.103]
changed: [172.31.0.102]
changed: [172.31.0.101]
TASK [copy keepalived.service file] ***********************************************************************************************************
ok: [172.31.0.103]
ok: [172.31.0.101]
ok: [172.31.0.104]
ok: [172.31.0.105]
ok: [172.31.0.102]
TASK [PATH variable] **************************************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.102]
changed: [172.31.0.105]
changed: [172.31.0.101]
TASK [PATH variable entry] ********************************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.101]
changed: [172.31.0.105]
changed: [172.31.0.102]
changed: [172.31.0.104]
TASK [start keepalived] ***********************************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.101]
changed: [172.31.0.102]
changed: [172.31.0.105]
PLAY RECAP ************************************************************************************************************************************
172.31.0.101 : ok=13 changed=10 unreachable=0 failed=0 skipped=6 rescued=0 ignored=0
172.31.0.102 : ok=13 changed=10 unreachable=0 failed=0 skipped=6 rescued=0 ignored=0
172.31.0.103 : ok=12 changed=10 unreachable=0 failed=0 skipped=7 rescued=0 ignored=0
172.31.0.104 : ok=14 changed=12 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
172.31.0.105 : ok=14 changed=12 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
[root@centos7-client ~]
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:a2:a3:2f brd ff:ff:ff:ff:ff:ff
inet 172.31.0.102/21 brd 172.31.7.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet 172.31.0.188/32 scope global eth0:1
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fea2:a32f/64 scope link
valid_lft forever preferred_lft forever
[root@centos7-client ~]
● keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2021-12-31 14:13:21 CST; 52s ago
Docs: man:keepalived(8)
man:keepalived.conf(5)
man:genhash(1)
https://keepalived.org
Process: 8389 ExecStart=/apps/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 8390 (keepalived)
CGroup: /system.slice/keepalived.service
├─8390 /apps/keepalived/sbin/keepalived -D
└─8391 /apps/keepalived/sbin/keepalived -D
Dec 31 14:13:25 centos7-client.example.local Keepalived_vrrp[8391]: Sending gratuitous ARP on eth0 for 172.31.0.188
Dec 31 14:13:25 centos7-client.example.local Keepalived_vrrp[8391]: Sending gratuitous ARP on eth0 for 172.31.0.188
Dec 31 14:13:25 centos7-client.example.local Keepalived_vrrp[8391]: Sending gratuitous ARP on eth0 for 172.31.0.188
Dec 31 14:13:27 centos7-client.example.local Keepalived_vrrp[8391]: smtp fd 15 returned write error
Dec 31 14:13:35 centos7-client.example.local Keepalived_vrrp[8391]: (VI_1) Sending/queueing gratuitous ARPs on eth0 for 172.31.0.188
Dec 31 14:13:35 centos7-client.example.local Keepalived_vrrp[8391]: Sending gratuitous ARP on eth0 for 172.31.0.188
Dec 31 14:13:35 centos7-client.example.local Keepalived_vrrp[8391]: Sending gratuitous ARP on eth0 for 172.31.0.188
Dec 31 14:13:35 centos7-client.example.local Keepalived_vrrp[8391]: Sending gratuitous ARP on eth0 for 172.31.0.188
Dec 31 14:13:35 centos7-client.example.local Keepalived_vrrp[8391]: Sending gratuitous ARP on eth0 for 172.31.0.188
Dec 31 14:13:35 centos7-client.example.local Keepalived_vrrp[8391]: Sending gratuitous ARP on eth0 for 172.31.0.188
[root@rocky8-client ~]
[PowerTools]
name=PowerTools
baseurl=https://mirrors.sjtug.sjtu.edu.cn/rocky/$releasever/PowerTools/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
2.keepalived-backup playbook
[root@ansible-server ansible]
[root@ansible-server ansible]
[root@ansible-server keepalived-backup]
[root@ansible-server keepalived-backup]
[root@ansible-server keepalived-backup]
URL: mirrors.cloud.tencent.com
ROCKY_URL: mirrors.sjtug.sjtu.edu.cn
KEEPALIVED_FILE: keepalived-2.2.4.tar.gz
SRC_DIR: /usr/local/src
KEEPALIVED_INSTALL_DIR: /apps/keepalived
STATE: BACKUP
PRIORITY: 80
VIP: 172.31.0.188
[root@ansible-server keepalived-backup]
[root@ansible-server keepalived-backup]
[PowerTools]
name=PowerTools
{
% if ansible_distribution =="Rocky" %}
baseurl=https://{
{
ROCKY_URL }}/rocky/$releasever/PowerTools/$basearch/os/
{
% elif ansible_distribution=="CentOS" %}
baseurl=https://{
{
URL }}/centos/$releasever/PowerTools/$basearch/os/
{
% endif %}
gpgcheck=1
{
% if ansible_distribution =="Rocky" %}
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
{
% elif ansible_distribution=="CentOS" %}
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
{
% endif %}
[root@ansible-server keepalived-backup]
! Configuration File for keepalived
global_defs {
notification_email {
acassen
}
notification_email_from [email protected]
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state {
{
STATE }}
interface {
{
ansible_default_ipv4.interface }}
garp_master_delay 10
smtp_alert
virtual_router_id 51
priority {
{
PRIORITY }}
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
{
{
VIP }} dev {
{
ansible_default_ipv4.interface }} label {
{
ansible_default_ipv4.interface }}:1
}
}
[root@ansible-server keepalived-backup]
---
- hosts: all
vars_files:
vars.yml
tasks:
- name: find "[PowerTools]" mirror warehouse
find:
path: /etc/yum.repos.d/
contains: '\[PowerTools\]'
register: RETURN
when:
- (ansible_distribution=="CentOS" or ansible_distribution=="Rocky")
- ansible_distribution_major_version=="8"
- name: copy repo file
template:
src: PowerTools.repo.j2
dest: /etc/yum.repos.d/PowerTools.repo
when:
- (ansible_distribution=="CentOS" or ansible_distribution=="Rocky") and (ansible_distribution_major_version=="8")
- RETURN.matched == 0
- name: install CentOS8 or Rocky8 depend on the package
yum:
name: make,gcc,ipvsadm,autoconf,automake,openssl-devel,libnl3-devel,iptables-devel,ipset-devel,file-devel,net-snmp-devel,glib2-devel,pcre2-devel,libnftnl-devel,libmnl-devel,systemd-devel
when:
- (ansible_distribution=="CentOS" or ansible_distribution=="Rocky")
- ansible_distribution_major_version=="8"
- name: install CentOS7 depend on the package
yum:
name: make,gcc,libnfnetlink-devel,libnfnetlink,ipvsadm,libnl,libnl-devel,libnl3,libnl3-devel,lm_sensors-libs,net-snmp-agent-libs,net-snmp-libs,openssh-server,openssh-clients,openssl,openssl-devel,automake,iproute
when:
- ansible_distribution=="CentOS"
- ansible_distribution_major_version=="7"
- name: delete lock files
file:
path: "{
{ item }}"
state: absent
loop:
- /var/lib/dpkg/lock
- /var/lib/apt/lists/lock
- /var/cache/apt/archives/lock
when:
- ansible_distribution=="Ubuntu"
- name: apt update
apt:
update_cache: yes
force: yes
when:
- ansible_distribution=="Ubuntu"
- name: install Ubuntu 20.04 depend on the package
apt:
name: make,gcc,ipvsadm,build-essential,pkg-config,automake,autoconf,libipset-dev,libnl-3-dev,libnl-genl-3-dev,libssl-dev,libxtables-dev,libip4tc-dev,libip6tc-dev,libipset-dev,libmagic-dev,libsnmp-dev,libglib2.0-dev,libpcre2-dev,libnftnl-dev,libmnl-dev,libsystemd-dev
force: yes
when:
- ansible_distribution=="Ubuntu"
- ansible_distribution_major_version=="20"
- name: install Ubuntu 18.04 depend on the package
apt:
name: make,gcc,ipvsadm,build-essential,pkg-config,automake,autoconf,iptables-dev,libipset-dev,libnl-3-dev,libnl-genl-3-dev,libssl-dev,libxtables-dev,libip4tc-dev,libip6tc-dev,libipset-dev,libmagic-dev,libsnmp-dev,libglib2.0-dev,libpcre2-dev,libnftnl-dev,libmnl-dev,libsystemd-dev
force: yes
when:
- ansible_distribution=="Ubuntu"
- ansible_distribution_major_version=="18"
- name: unarchive keepalived package
unarchive:
src: "{
{ KEEPALIVED_FILE }}"
dest: "{
{ SRC_DIR }}"
- name: get KEEPALIVED_DIR directory
shell:
cmd: echo {
{
KEEPALIVED_FILE }} | sed -nr 's/^(.*[0-9]).([[:lower:]]).*/\1/p'
register: KEEPALIVED_DIR
- name: Build and install Keepalived
shell:
chdir: "{
{ SRC_DIR }}/{
{ KEEPALIVED_DIR.stdout }}"
cmd: ./configure --prefix={
{
KEEPALIVED_INSTALL_DIR }} --disable-fwmark
- name: make && make install
shell:
chdir: "{
{ SRC_DIR }}/{
{ KEEPALIVED_DIR.stdout }}"
cmd: make -j {
{
ansible_processor_vcpus }} && make install
- name: create /etc/keepalived directory
file:
path: /etc/keepalived
state: directory
- name: copy keepalived.conf file
template:
src: keepalived.conf.j2
dest: /etc/keepalived/keepalived.conf
- name: copy keepalived.service file
copy:
remote_src: True
src: "{
{ SRC_DIR }}/{
{ KEEPALIVED_DIR.stdout }}/keepalived/keepalived.service"
dest: /lib/systemd/system/
- name: PATH variable
copy:
content: 'PATH={
{ KEEPALIVED_INSTALL_DIR }}/sbin:$PATH'
dest: /etc/profile.d/keepalived.sh
- name: PATH variable entry
shell:
cmd: . /etc/profile.d/keepalived.sh
- name: start keepalived
systemd:
name: keepalived
state: started
enabled: yes
daemon_reload: yes
[root@ansible-server keepalived-backup]
[root@ansible-server ansible]
PLAY [all] ************************************************************************************************************************************
TASK [Gathering Facts] ************************************************************************************************************************
ok: [172.31.0.103]
ok: [172.31.0.101]
ok: [172.31.0.102]
ok: [172.31.0.105]
ok: [172.31.0.104]
TASK [find "[PowerTools]" mirror warehouse] ***************************************************************************************************
skipping: [172.31.0.103]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
ok: [172.31.0.101]
ok: [172.31.0.102]
TASK [copy repo file] *************************************************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.103]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
TASK [install CentOS8 or Rocky8 depend on the package] ****************************************************************************************
skipping: [172.31.0.103]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
changed: [172.31.0.101]
changed: [172.31.0.102]
TASK [install CentOS7 depend on the package] **************************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
changed: [172.31.0.103]
TASK [delete lock files] **********************************************************************************************************************
skipping: [172.31.0.101] => (item=/var/lib/dpkg/lock)
skipping: [172.31.0.101] => (item=/var/lib/apt/lists/lock)
skipping: [172.31.0.101] => (item=/var/cache/apt/archives/lock)
skipping: [172.31.0.102] => (item=/var/lib/dpkg/lock)
skipping: [172.31.0.102] => (item=/var/lib/apt/lists/lock)
skipping: [172.31.0.102] => (item=/var/cache/apt/archives/lock)
skipping: [172.31.0.103] => (item=/var/lib/dpkg/lock)
skipping: [172.31.0.103] => (item=/var/lib/apt/lists/lock)
skipping: [172.31.0.103] => (item=/var/cache/apt/archives/lock)
ok: [172.31.0.104] => (item=/var/lib/dpkg/lock)
changed: [172.31.0.105] => (item=/var/lib/dpkg/lock)
changed: [172.31.0.105] => (item=/var/lib/apt/lists/lock)
changed: [172.31.0.104] => (item=/var/lib/apt/lists/lock)
ok: [172.31.0.104] => (item=/var/cache/apt/archives/lock)
changed: [172.31.0.105] => (item=/var/cache/apt/archives/lock)
TASK [apt update] *****************************************************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.105]
TASK [install Ubuntu 20.04 depend on the package] *********************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.103]
skipping: [172.31.0.102]
skipping: [172.31.0.104]
changed: [172.31.0.105]
TASK [install Ubuntu 18.04 depend on the package] *********************************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.103]
skipping: [172.31.0.105]
changed: [172.31.0.104]
TASK [unarchive keepalived package] **********************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.101]
changed: [172.31.0.102]
changed: [172.31.0.104]
changed: [172.31.0.105]
TASK [get KEEPALIVED_DIR directory] ***********************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.105]
changed: [172.31.0.104]
changed: [172.31.0.101]
changed: [172.31.0.102]
TASK [Build and install Keepalived] ***********************************************************************************************************
changed: [172.31.0.104]
changed: [172.31.0.103]
changed: [172.31.0.102]
changed: [172.31.0.105]
changed: [172.31.0.101]
TASK [make && make install] *******************************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.101]
changed: [172.31.0.102]
changed: [172.31.0.105]
TASK [create /etc/keepalived directory] *******************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.101]
changed: [172.31.0.102]
changed: [172.31.0.105]
TASK [copy keepalived.conf file] **************************************************************************************************************
changed: [172.31.0.105]
changed: [172.31.0.104]
changed: [172.31.0.103]
changed: [172.31.0.102]
changed: [172.31.0.101]
TASK [copy keepalived.service file] ***********************************************************************************************************
ok: [172.31.0.103]
ok: [172.31.0.101]
ok: [172.31.0.104]
ok: [172.31.0.105]
ok: [172.31.0.102]
TASK [PATH variable] **************************************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.102]
changed: [172.31.0.105]
changed: [172.31.0.101]
TASK [PATH variable entry] ********************************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.101]
changed: [172.31.0.105]
changed: [172.31.0.102]
changed: [172.31.0.104]
TASK [start keepalived] ***********************************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.101]
changed: [172.31.0.102]
changed: [172.31.0.105]
PLAY RECAP ************************************************************************************************************************************
172.31.0.101 : ok=13 changed=10 unreachable=0 failed=0 skipped=6 rescued=0 ignored=0
172.31.0.102 : ok=13 changed=10 unreachable=0 failed=0 skipped=6 rescued=0 ignored=0
172.31.0.103 : ok=12 changed=10 unreachable=0 failed=0 skipped=7 rescued=0 ignored=0
172.31.0.104 : ok=14 changed=12 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
172.31.0.105 : ok=14 changed=12 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0