pvc-ansible/roles/pvc/tasks/zookeeper/main.yml

79 lines
1.8 KiB
YAML

---
- name: install zookeeper packages
apt:
name:
- zookeeper
- zookeeper-bin
- zkcli
state: latest
register: apt_res
retries: 5
until: apt_res is success
- name: install zookeeper configuration
template:
src: zookeeper/{{ item }}.j2
dest: /etc/zookeeper/conf/{{ item }}
with_items:
- configuration.xsl
- environment
- log4j.properties
- myid
- zoo.cfg
notify: restart zookeeper
- name: install Prometheus zookeeper exporter if enabled
apt:
name:
- prometheus-zookeeper-exporter
register: apt_res
retries: 5
until: apt_res is success
when: enable_prometheus_exporters is defined and enable_prometheus_exporters
- name: install Prometheus zookeeper exporter config if enabled
template:
src: patroni/prometheus.env.j2
dest: /etc/default/prometheus-zookeeper-exporter
owner: prometheus
group: prometheus
mode: 0640
notify:
- restart prometheus-zookeeper
when: enable_prometheus_exporters is defined and enable_prometheus_exporters
- name: install daily vacuum script
template:
src: zookeeper/zookeeper-vacuum.j2
dest: /etc/cron.daily/zookeeper-vacuum
mode: 0755
- name: install check_mk agent check
template:
src: zookeeper/zk_status.j2
dest: /usr/lib/check_mk_agent/plugins/zk_status
mode: 0755
- name: install systemd unit file
template:
src: zookeeper/zookeeper.service.j2
dest: /etc/systemd/system/zookeeper.service
register: systemd
- name: reload systemd to apply changes
command: systemctl daemon-reload
when: systemd.changed
- name: start but disable services (managed by PVC)
service:
name: "{{ item }}"
state: started
enabled: no
with_items:
- zookeeper
- include: zookeeper/bootstrap.yml
when: do_bootstrap is defined and do_bootstrap
- meta: flush_handlers