forked from TOSIT-IO/tdp-getting-started
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-hive.yml
52 lines (47 loc) · 1.8 KB
/
deploy-hive.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
- hosts: localhost
become: False
tasks:
- name: Check hive binary exists
stat:
path: files/apache-hive-3.1.3-TDP-0.1.0-SNAPSHOT-bin.tar.gz
register: hive_exists
failed_when: hive_exists.stat.exists == False
- name: Prepare postgresql for hive
hosts: postgresql
become: yes
become_user: postgres
tasks:
- include_role:
name: ansible_roles/collections/ansible_collections/tosit/tdp_extra/roles/ansible-tdp-common-actions
tasks_from: deploy-new-postgres-role
with_items:
- hive
- name: Deploy Hive
import_playbook: ansible_roles/collections/ansible_collections/tosit/tdp/playbooks/meta/hive.yml
- hosts: yarn_nm,yarn_rm
become: yes
tasks:
- name: Ensure hive user on all yarn nodemanagers and resource managers
user:
name: hive
password: '{{ "hive123" | password_hash("sha512", "salt123") }}'
- name: Generate hive user principal and keytab on all yarn nodemanagers and resource managers
become: yes
shell: |
kadmin -r {{realm}} -p {{kadmin_principal}} -w {{kadmin_password}} -q "addprinc -randkey hive/{{ ansible_fqdn }}@{{realm}}"
kadmin -r {{realm}} -p {{kadmin_principal}} -w {{kadmin_password}} -q "xst -k hive.service.keytab hive/{{ ansible_fqdn }}@{{realm}}"
chown hive:hadoop hive.service.keytab
args:
chdir: /etc/security/keytabs
creates: /etc/security/keytabs/hive.principal.keytab
# TODO: move this somewhere else
# - hosts: ranger_admin[0]
# become: yes
# tasks:
# - name: Deploy ranger hdfs policies
# include_role:
# name: ansible_roles/collections/ansible_collections/tosit/tdp_extra/roles/ansible-tdp-common-actions
# tasks_from: deploy-ranger-hdfs-policy
# with_items:
# - "{{ ranger_hdfs_policies }}"