Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - hosts: edge
- sudo: True
- vars:
- users: [hsunami]
- tasks:
- - name: Create users
- with_items: "{{ users }}"
- user:
- name: "{{ item }}"
- shell: /bin/bash
- generate_ssh_key: yes
- ssh_key_bits: 2048
- ssh_key_file: .ssh/id_rsa
- groups: writers,hadoop
- - name: Create authorized keys file
- with_items: "{{ users }}"
- command: creates="/home/{{item}}/.ssh/authorized_keys" cp /home/{{item}}/.ssh/id_rsa.pub /home/{{item}}/.ssh/authorized_keys
- - name: Create HDFS home dirs for users
- with_items: "{{ users }}"
- action: |
- command sudo -u hdfs -- /bin/sh -c '
- hadoop fs -mkdir -p /user/{{item}}
- hadoop fs -chown {{item}}:hadoop /user/{{item}}
- hadoop fs -chmod -R 755 /user/{{item}}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement