---
- name: install zookeeper server pkgs
  apt: name={{ item }}={{ version['zookeeper'] }} state=present force=yes update_cache=yes
  with_items:
  - zookeeper-server
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

- name: create zookeeper_datadir
  file: path={{ zookeeper_datadir }} state=directory owner=zookeeper group=zookeeper mode=0755
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

- name: init zookeeper server
  shell: service zookeeper-server init --myid={{ zookeeper_myid }}  creates={{ zookeeper_datadir }}/myid
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

- name: create zookeeper cfg
  template: src=zoo.cfg.j2 dest=/etc/zookeeper/conf/zoo.cfg owner=zookeeper group=zookeeper mode=0644
  notify: restart zookeeper server
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

- name: start zookeeper server
  service: name=zookeeper-server state=started
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

---
- name: install zookeeper server pkgs
  apt: name={{ item }}={{ version['zookeeper'] }} state=present force=yes
  with_items:
  - zookeeper-server
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

- name: create zookeeper_datadir
  file: path={{ zookeeper_datadir }} state=directory owner=zookeeper group=zookeeper mode=0755
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

- name: init zookeeper server
  shell: service zookeeper-server init --myid={{ zookeeper_myid }}  creates={{ zookeeper_datadir }}/myid
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

- name: create zookeeper cfg
  template: src=zoo.cfg.j2 dest=/etc/zookeeper/conf/zoo.cfg owner=zookeeper group=zookeeper mode=0644
  notify: restart zookeeper server
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

- name: start zookeeper server
  service: name=zookeeper-server state=started
  tags:
  - cdh5-zookeeper
  - cdh5-zookeeperserver

Remove cache update for zookeeper
Remove cache update for zookeeper
