hadoop-ansible/roles/other-services/tasks/users.yml

50 lines
1.4 KiB
YAML

---
- name: Create the supergroup group
group: name=supergroup state=present
tags:
- other-services
- hadoop
- oozie
- users
- name: Change the oozie user shell
user: name=oozie shell=/bin/bash
tags:
- other-services
- oozie
- name: Create users on the oozie server
user: name={{ item.login }} comment="{{ item.name }}" home=/home/{{ item.login }} createhome=yes shell=/bin/bash groups=supergroup
with_items: '{{ hadoop_users }}'
when: item.ssh_key is defined
register: create_user
tags:
- other-services
- oozie
- users
- oozie_users
- name: ensure that the users that need to use oozie can login with their account
authorized_key: user="{{ item.login }}" key="{{ item.ssh_key }}" state=present
with_items: '{{ hadoop_users }}'
when:
- create_user.changed
- item.ssh_key is defined
tags:
- other-services
- oozie
- users
- oozie_users
- name: Activate the hive user on hdfs.
remote_user: root
become: yes
become_user: hdfs
shell: . /etc/profile.d/jdk.sh ; hadoop fs -mkdir {{ mapred_staging_root_dir }}/{{ hive.user }}/warehouse ; hadoop fs -chown -R {{ hive.user }}:{{ hive.user }} {{ mapred_staging_root_dir }}/{{ hive.user }} ; hadoop fs -chmod -R 770 {{ mapred_staging_root_dir }}/{{ hive.user }}/warehouse ; touch /var/lib/hadoop-hdfs/.{{ hive.user }}
args:
creates: /var/lib/hadoop-hdfs/.{{ hive.user }}
tags:
- hive
- users