---
#--------------------------------------------------------------#
# Config vip-manager                             [pg_vip_config]
#--------------------------------------------------------------#
- name: config vip-manager
  tags: pg_vip_config
  template: src={{ item.src }} dest={{ item.dest }} owner={{ item.owner }} group={{ item.group }} mode={{ item.mode }}
  with_items:
    - { src: "vip-manager.yml" ,dest: "/etc/default/vip-manager.yml" ,owner: root ,group: postgres ,mode: "0600" }
    - { src: "vip-manager.svc" ,dest: "{{ systemd_svc_path }}"       ,owner: root ,group: root     ,mode: "0644" }
  vars:
    pg_vip_addr: "{{ pg_vip_address.split('/')[0] }}"
    pg_vip_cidr: "{{ pg_vip_address.split('/')[1] }}"
    systemd_svc_path: "{{ systemd_dir|default('/usr/lib/systemd/system') }}/vip-manager.service"

#--------------------------------------------------------------#
#  Launch vip-manager                            [pg_vip_launch]
#--------------------------------------------------------------#
- name: launch vip-manager
  tags: pg_vip_launch
  when: pg_vip_enabled|bool and pg_reload|bool
  systemd: name=vip-manager state=restarted enabled=yes daemon_reload=true
...