提交各组件部署Ansible剧本初版
This commit is contained in:
45
Apache HBase/2.2.3/hbase/role/tasks/uninstall.yml
Normal file
45
Apache HBase/2.2.3/hbase/role/tasks/uninstall.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
- block:
|
||||
- name: Stopping and removing container
|
||||
docker_container:
|
||||
name: '{{ item }}'
|
||||
state: absent
|
||||
with_items:
|
||||
- ['HMaster']
|
||||
- ['HRegionServer']
|
||||
|
||||
- name: Removing old {{ image_name }} image
|
||||
docker_image:
|
||||
name: '{{ image_name }}'
|
||||
tag: '{{ image_tag }}'
|
||||
state: absent
|
||||
|
||||
- name: Ansible delete old {{ deploy_dir }}/{{ container_name }}
|
||||
file:
|
||||
path: '{{ deploy_dir }}/{{ container_name }}'
|
||||
state: absent
|
||||
|
||||
- name: Checking ZooKeeper has HBase nodes
|
||||
shell: "docker exec -it zookeeper zkCli.sh ls / | grep hbase | wc -l"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups.zookeeper[0] }}"
|
||||
register: has_zknode
|
||||
|
||||
- name: Delete HBase nodes in ZooKeeper
|
||||
shell: "docker exec -it zookeeper zkCli.sh rmr /hbase"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups.zookeeper[0] }}"
|
||||
when: has_zknode.stdout >= '1'
|
||||
|
||||
- block:
|
||||
- name: Checking HDFS has hbase folder
|
||||
shell: source /etc/profile && hdfs dfs -ls / | grep hbase | wc -l
|
||||
register: folder_exists
|
||||
run_once: true
|
||||
delegate_to: "{{ groups.hdfs[0] }}"
|
||||
|
||||
- name: Delete HBase data folder in HDFS
|
||||
shell: source /etc/profile && hadoop fs -rm -r /hbase
|
||||
run_once: true
|
||||
delegate_to: "{{ groups.hdfs[0] }}"
|
||||
when: folder_exists.stdout >= '1'
|
||||
when: (groups.hbase) | length > 1
|
||||
Reference in New Issue
Block a user