James E. Blair 42574b2b37 Run ZK from containers
Migration plan:
* add zk* to emergency
* copy data files on each node to a safe place for DR backup
* make a json data backup: zk-shell localhost:2181 --run-once 'mirror / json://!tmp!zookeeper-backup.json/'
* manually run a modified playbook to set up the docker infra without starting containers
* rolling restart; for each node:
  * stop zk
  * split data and log files and move them to new locations
  * remove zk packages
  * start zk containers
* remove from emergency; land this change.

Change-Id: Ic06c9cf9604402aa8eb4bb79238021c14c5d9563
2020-04-17 08:43:09 -07:00

56 lines
1.2 KiB
YAML

- name: Create Zookeeper group
group:
name: "zookeeper"
gid: 10001
system: yes
- name: Create Zookeeper User
user:
name: "zookeeper"
uid: 10001
comment: Zookeeper
shell: /bin/false
group: "zookeeper"
home: "/var/zookeeper"
create_home: no
system: yes
- name: Synchronize compose directory
synchronize:
src: zookeeper-compose/
dest: /etc/zookeeper-compose/
- name: Ensure volume directories exist
file:
state: directory
path: "/var/zookeeper/{{ item }}"
owner: zookeeper
group: zookeeper
loop:
- conf
- data
- datalog
- logs
- name: Write config
template:
src: zoo.cfg.j2
dest: /var/zookeeper/conf/zoo.cfg
- name: Write ID file
template:
src: myid.j2
dest: /var/zookeeper/data/myid
# Temporary until 719589 merges.
- name: Install docker-compose
pip:
name: docker-compose
state: present
executable: pip3
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/zookeeper-compose/
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/zookeeper-compose/
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f