diff --git a/playbooks/hdfs_namenode_decomm_datanode.yml b/playbooks/hdfs_namenode_decomm_datanode.yml new file mode 100644 index 00000000..2fc62f1a --- /dev/null +++ b/playbooks/hdfs_namenode_decomm_datanode.yml @@ -0,0 +1,14 @@ +# Copyright 2022 TOSIT.IO +# SPDX-License-Identifier: Apache-2.0 + +--- +- name: Hadoop HDFS datanode Decommission + hosts: hdfs_nn + tasks: + - tosit.tdp.resolve: # noqa unnamed-task + node_name: hdfs_namenode + - name: Decommission HDFS datanode + ansible.builtin.import_role: + name: tosit.tdp.hdfs.namenode + tasks_from: decommission + - ansible.builtin.meta: clear_facts # noqa unnamed-task diff --git a/playbooks/yarn_resourcemanager_decomm_nodemanager.yml b/playbooks/yarn_resourcemanager_decomm_nodemanager.yml new file mode 100644 index 00000000..466ddc7a --- /dev/null +++ b/playbooks/yarn_resourcemanager_decomm_nodemanager.yml @@ -0,0 +1,14 @@ +# Copyright 2022 TOSIT.IO +# SPDX-License-Identifier: Apache-2.0 + +--- +- name: Hadoop Yarn resourcemanager decommission + hosts: yarn_rm + tasks: + - tosit.tdp.resolve: # noqa unnamed-task + node_name: yarn_resourcemanager + - name: Decommision YARN NM + ansible.builtin.import_role: + name: tosit.tdp.yarn.resourcemanager + tasks_from: decommission + - ansible.builtin.meta: clear_facts # noqa unnamed-task diff --git a/roles/hdfs/namenode/tasks/decommission.yml b/roles/hdfs/namenode/tasks/decommission.yml new file mode 100644 index 00000000..95054dc9 --- /dev/null +++ b/roles/hdfs/namenode/tasks/decommission.yml @@ -0,0 +1,26 @@ +# Copyright 2022 TOSIT.IO +# SPDX-License-Identifier: Apache-2.0 + +--- +- name: Render dfs.exclude file + ansible.builtin.template: + src: dfs.exclude.j2 + dest: "{{ hdfs_site['dfs.hosts.exclude'] }}" + owner: root + group: root + mode: "644" + +- name: Update exlude nodes file + ansible.builtin.lineinfile: + path: /etc/hadoop/conf.nn/dfs.exclude + line: "{{ item }}" + state: present + loop: "{{ [excluded_node] }}" + +- name: "kinit hdfs NN" + ansible.builtin.command: kinit -kt /etc/security/keytabs/nn.service.keytab nn/{{ ansible_fqdn }}@{{ realm }} + become_user: hdfs + +- name: "RefreshNodes" + ansible.builtin.command: /usr/bin/hdfs dfsadmin -refreshNodes + become_user: hdfs diff --git a/roles/yarn/resourcemanager/tasks/decommission.yml b/roles/yarn/resourcemanager/tasks/decommission.yml new file mode 100644 index 00000000..57230018 --- /dev/null +++ b/roles/yarn/resourcemanager/tasks/decommission.yml @@ -0,0 +1,26 @@ +# Copyright 2022 TOSIT.IO +# SPDX-License-Identifier: Apache-2.0 + +--- +- name: Render yarn.exclude file + ansible.builtin.template: + src: yarn.exclude.j2 + dest: "{{ yarn_site['yarn.resourcemanager.nodes.exclude-path'] }}" + owner: root + group: root + mode: "644" + +- name: Update exlude nodes file + ansible.builtin.lineinfile: + path: /etc/hadoop/conf.rm/yarn.exclude + line: "{{ item }}" + state: present + loop: "{{ [excluded_node] }}" + +- name: "kinit yarn RM" + ansible.builtin.command: kinit -kt /etc/security/keytabs/rm.service.keytab rm/{{ ansible_fqdn }}@{{ realm }} + become_user: yarn + +- name: "RefreshNodes" + ansible.builtin.command: /usr/bin/yarn rmadmin -refreshNodes + become_user: yarn