0
点赞
收藏
分享

微信扫一扫

a21.ansible 生产实战案例 --keepalived roles

1.keepalived-master roles

[root@ansible-server ansible]# mkdir -p roles/keepalived-master/{tasks,files,vars,templates}
[root@ansible-server ansible]# cd roles/keepalived_master/
[root@ansible-server keepalived-master]# ls
files  tasks  templates  vars

[root@ansible-server keepalived-master]#  wget https://keepalived.org/software/keepalived-2.2.4.tar.gz -P files/

[root@ansible-server keepalived-master]# vim vars/main.yml
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]# vim templates/PowerTools.repo.j2 
[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]# vim templates/keepalived.conf.j2
! Configuration File for keepalived

global_defs {
   notification_email {
     acassen
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   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]# vim tasks/install_package.yml
- 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"

[root@ansible-server keepalived-master]# vim tasks/keepalived_file.yml
- name: unarchive  keepalived package
  unarchive:
    src: "{{ KEEPALIVED_FILE }}"
    dest: "{{ SRC_DIR }}"

[root@ansible-server keepalived_master]# vim tasks/build.yml
- 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

[root@ansible-server keepalived-master]# vim tasks/config.yml
- 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

[root@ansible-server keepalived-master]# vim tasks/service.yml
- name: start keepalived
  systemd:
    name: keepalived
    state: started
    enabled: yes
    daemon_reload: yes

[root@ansible-server keepalived-master]# vim tasks/main.yml
- include: install_package.yml
- include: keepalived_file.yml
- include: build.yml
- include: config.yml
- include: service.yml

[root@ansible-server keepalived-master]# cd ../../
[root@ansible-server ansible]# tree roles/keepalived-master/
roles/keepalived-master/
├── files
│   └── keepalived-2.2.4.tar.gz
├── tasks
│   ├── build.yml
│   ├── config.yml
│   ├── install_package.yml
│   ├── keepalived_file.yml
│   ├── main.yml
│   └── service.yml
├── templates
│   ├── keepalived.conf.j2
│   └── PowerTools.repo.j2
└── vars
    └── main.yml

4 directories, 10 files

[root@ansible-server ansible]# vim keepalived_master_role.yml
---
- hosts: all

  roles:
    - role: keepalived-master

[root@ansible-server ansible]# ansible-playbook keepalived_master_role.yml 

PLAY [all] ************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************
ok: [172.31.0.103]
ok: [172.31.0.104]
ok: [172.31.0.101]
ok: [172.31.0.102]
ok: [172.31.0.105]

TASK [keepalived-master : 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 [keepalived-master : 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 [keepalived-master : 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.102]
changed: [172.31.0.101]

TASK [keepalived-master : 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 [keepalived-master : 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.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) 
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) 
changed: [172.31.0.104] => (item=/var/lib/dpkg/lock)
changed: [172.31.0.105] => (item=/var/lib/dpkg/lock)
changed: [172.31.0.104] => (item=/var/lib/apt/lists/lock)
changed: [172.31.0.105] => (item=/var/lib/apt/lists/lock)
changed: [172.31.0.104] => (item=/var/cache/apt/archives/lock)
changed: [172.31.0.105] => (item=/var/cache/apt/archives/lock)

TASK [keepalived-master : 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 [keepalived-master : install Ubuntu 20.04 depend on the package] *************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.103]
skipping: [172.31.0.104]
changed: [172.31.0.105]

TASK [keepalived-master : 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 [keepalived-master : unarchive  keepalived package] **************************************************************************************
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 [keepalived-master : 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 [keepalived-master : Build and install Keepalived] ***************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.105]
changed: [172.31.0.102]
changed: [172.31.0.101]

TASK [keepalived-master : make && make install] ***********************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.102]
changed: [172.31.0.101]
changed: [172.31.0.105]

TASK [keepalived-master : create /etc/keepalived 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 [keepalived-master : copy keepalived.conf file] ******************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.105]
changed: [172.31.0.101]
changed: [172.31.0.102]

TASK [keepalived-master : copy keepalived.service file] ***************************************************************************************
ok: [172.31.0.103]
ok: [172.31.0.105]
ok: [172.31.0.104]
ok: [172.31.0.102]
ok: [172.31.0.101]

TASK [keepalived-master : PATH variable] ******************************************************************************************************
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 [keepalived-master : PATH variable entry] ************************************************************************************************
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 [keepalived-master : 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 

2.keepalived-backup roles

[root@ansible-server ansible]# mkdir -p roles/keepalived-backup/{tasks,files,vars,templates}
[root@ansible-server ansible]# cd roles/keepalived_backup/
[root@ansible-server keepalived-master]# ls
files  tasks  templates  vars

[root@ansible-server keepalived-backup]#  wget https://keepalived.org/software/keepalived-2.2.4.tar.gz -P files/

[root@ansible-server keepalived-backup]# vim vars/main.yml
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]# vim templates/PowerTools.repo.j2 
[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]# vim templates/keepalived.conf.j2
! Configuration File for keepalived

global_defs {
   notification_email {
     acassen
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   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]# vim tasks/install_package.yml
- 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"

[root@ansible-server keepalived-backup]# vim tasks/keepalived_file.yml
- name: unarchive  keepalived package
  unarchive:
    src: "{{ KEEPALIVED_FILE }}"
    dest: "{{ SRC_DIR }}"

[root@ansible-server keepalived_backup]# vim tasks/build.yml
- 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

[root@ansible-server keepalived-backup]# vim tasks/config.yml
- 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

[root@ansible-server keepalived-backup]# vim tasks/service.yml
- name: start keepalived
  systemd:
    name: keepalived
    state: started
    enabled: yes
    daemon_reload: yes

[root@ansible-server keepalived-backup]# vim tasks/main.yml
- include: install_package.yml
- include: keepalived_file.yml
- include: build.yml
- include: config.yml
- include: service.yml

[root@ansible-server keepalived-backup]# cd ../../
[root@ansible-server ansible]# tree roles/keepalived-backup/
roles/keepalived-backup/
├── files
│   └── keepalived-2.2.4.tar.gz
├── tasks
│   ├── build.yml
│   ├── config.yml
│   ├── install_package.yml
│   ├── keepalived_file.yml
│   ├── main.yml
│   └── service.yml
├── templates
│   ├── keepalived.conf.j2
│   └── PowerTools.repo.j2
└── vars
    └── main.yml

4 directories, 10 files

[root@ansible-server ansible]# vim keepalived_backup_role.yml 
---
- hosts: all

  roles:
    - role: keepalived-backup

[root@ansible-server ansible]# ansible-playbook keepalived_backup_role.yml 

PLAY [all] ************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************
ok: [172.31.0.103]
ok: [172.31.0.104]
ok: [172.31.0.101]
ok: [172.31.0.102]
ok: [172.31.0.105]

TASK [keepalived-backup : find "[PowerTools]" mirror warehouse] *******************************************************************************
skipping: [172.31.0.103]
skipping: [172.31.0.104]
skipping: [172.31.0.105]
ok: [172.31.0.102]
ok: [172.31.0.101]

TASK [keepalived-backup : 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 [keepalived-backup : 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.102]
changed: [172.31.0.101]

TASK [keepalived-backup : 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 [keepalived-backup : 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) 
changed: [172.31.0.104] => (item=/var/lib/dpkg/lock)
changed: [172.31.0.105] => (item=/var/lib/dpkg/lock)
changed: [172.31.0.104] => (item=/var/lib/apt/lists/lock)
changed: [172.31.0.105] => (item=/var/lib/apt/lists/lock)
changed: [172.31.0.104] => (item=/var/cache/apt/archives/lock)
changed: [172.31.0.105] => (item=/var/cache/apt/archives/lock)

TASK [keepalived-backup : 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 [keepalived-backup : install Ubuntu 20.04 depend on the package] *************************************************************************
skipping: [172.31.0.101]
skipping: [172.31.0.102]
skipping: [172.31.0.103]
skipping: [172.31.0.104]
changed: [172.31.0.105]

TASK [keepalived-backup : 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 [keepalived-backup : unarchive  keepalived package] **************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.102]
changed: [172.31.0.101]
changed: [172.31.0.105]

TASK [keepalived-backup : get KEEPALIVED_DIR directory] ***************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.105]
changed: [172.31.0.101]
changed: [172.31.0.102]

TASK [keepalived-backup : Build and install Keepalived] ***************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.105]
changed: [172.31.0.102]
changed: [172.31.0.101]

TASK [keepalived-backup : make && make install] ***********************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.102]
changed: [172.31.0.101]
changed: [172.31.0.105]

TASK [keepalived-backup : create /etc/keepalived directory] ***********************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.105]
changed: [172.31.0.102]
changed: [172.31.0.101]

TASK [keepalived-backup : copy keepalived.conf file] ******************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.104]
changed: [172.31.0.105]
changed: [172.31.0.101]
changed: [172.31.0.102]

TASK [keepalived-backup : copy keepalived.service file] ***************************************************************************************
ok: [172.31.0.103]
ok: [172.31.0.105]
ok: [172.31.0.104]
ok: [172.31.0.102]
ok: [172.31.0.101]

TASK [keepalived-backup : PATH variable] ******************************************************************************************************
changed: [172.31.0.103]
changed: [172.31.0.105]
changed: [172.31.0.104]
changed: [172.31.0.102]
changed: [172.31.0.101]

TASK [keepalived-backup : PATH variable entry] ************************************************************************************************
changed: [172.31.0.104]
changed: [172.31.0.105]
changed: [172.31.0.103]
changed: [172.31.0.102]
changed: [172.31.0.101]

TASK [keepalived-backup : start keepalived] ***************************************************************************************************
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]

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  
举报

相关推荐

0 条评论