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

49 lines
986 B
YAML
Raw Normal View History

2019-06-09 00:11:06 -04:00
---
- name: install pvc packages
apt:
name:
- pvc-daemon
- pvc-client-cli
- pvc-client-common
state: latest
- name: install pvc configuration
template:
src: pvc/{{ item }}.j2
dest: /etc/pvc/{{ item }}
with_items:
- pvcd.yaml
notify: restart pvcd
- name: verify if cluster has been started
shell: "/usr/share/zookeeper/bin/zkCli.sh stat /nodes 2>&1 | grep -q 'Node does not exist'"
register: cluster_init
failed_when: no
2019-06-12 10:33:48 -04:00
run_once: yes
2019-06-09 00:11:06 -04:00
- name: bootstrap a fresh cluster
shell: /usr/bin/pvc init
2019-06-12 10:33:48 -04:00
when: cluster_init.rc == 0
run_once: yes
2019-06-09 00:11:06 -04:00
- name: stop and disable unneccessary services
service:
name: "{{ item }}"
state: stopped
enabled: no
with_items:
- pdns.service
2019-06-12 10:33:48 -04:00
- include: remove_cluster_ips.yml
when: newhost.changed
2019-06-09 00:11:06 -04:00
- name: start and enable services
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- pvc-flush.service
- pvcd.service
- pvcd.target