# SET ACL permissions on Hadoop folder using Ansible script

**URL:** <https://forum.ansible.com/t/set-acl-permissions-on-hadoop-folder-using-ansible-script/28180>\
**Category:** Ansible Project\
**Created:** [July 27, 2018, 8:01pm UTC](https://forum.ansible.com/t/set-acl-permissions-on-hadoop-folder-using-ansible-script/28180 "2018-07-27T20:01:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bibhu](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@bibhu](https://forum.ansible.com/u/bibhu)\
**Post date:** [July 27, 2018, 8:01pm UTC](https://forum.ansible.com/t/set-acl-permissions-on-hadoop-folder-using-ansible-script/28180/1 "2018-07-27T20:01:34Z")

</div>

Hi ,

As my requirement is i need to set the ACL permissions on my folder which are there in my hadoop system, application wise folder name would be change.

REQUIREMENT IS:

1. We need to setup the ACL permissions for Hadoop folder as mentioned below

hdfs dfs -setfacl -R -b /river/axa\_us/”application name”/data/

hdfs dfs -setfacl -R -m user:axa\_us-sluice:rwx,user:axa\_us\_andesa-sluice:rwx,user:hive:rwx,user:impala:rwx,group:axa\_us\_andesa:rwx,group:axa\_us\_andesa\_ro:r-x,mask::rwx

/river/axa\_us/andesa/data/files/parquet/

hdfs dfs -chmod -R 770 /river/axa\_us/”application name”/data/files/parquet/

hdfs dfs -chggrp supergroup /river/axa\_us/”application name”/data/files/parquet/\*

1. So prior to set the ACL permissions usually we need to initialize the keytab as “ kinit –kt pbibhu.keytab pbibhu” in a server that is l51hdvmp-5 and need to push the keytab to l51hdvmp-11

Could you please help me what would be the ansible script/module for the requirement 2 and i have written the ansible module for requirement 1 as mentioned below .please suggest whether it is correct or i need to modify anything

- hosts: l51hdvmp-11.na.bigdata.intraxa

become: yes

vars\_prompt:

- name: “app\_name”

prompt: “please enter the application name to set the ACL permission”

private: no

- name: “group\_name”

prompt: “please enter the application name to set the Group permission”

private: no

tasks:

- name: reset the ACL Permission

action: shell hdfs dfs -setfacl -R -b /river/axa\_us/“{{app\_name}}”/data/

- name: modify the acl permisiion

action: shell hdfs dfs -setfacl -R -m user:axa\_us-sluice:rwx,axa\_us\_“{{group\_name}}”-

sluice:rwx,user:hive:rwx,user:impala:rwx,group:axa\_us\_“{{group\_name}}”:rwx,group:axa\_us\_“{{group\_name}}”\_ro:r-x,mask::rwx /river/axa\_us/“{{app\_name}}”

- name: set the permisiion of the directory

action: shell hadoop dfs -chmod 770 /river/axa\_us/“{{app\_name}}”/data/

- name: change the group as supergroup

action: shell hadoop dfs -chgrp supergroup /river/axa\_us/“{{app\_name}}”/data/\*
