SET ACL permissions on Hadoop folder using Ansible script

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/*