Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-18722

Post-user-creation script hook



    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • 2.5.0
    • ambari-server
    • None


      When users are created in the Ambari DB, either through manual user creation in the UI, or automated creation through LDAP sync, many users have different needs for initializing those users. The most common is creating /user/<username> HDFS home directories for each user. Since the exact initialization steps vary from customer to customer, the idea would be to have a single script in /var/lib/ambari-server/resources that can be executed for each user that is created.

      This feature would be disabled by default, and will be only configured via properties in /etc/ambari-server/conf/ambari.properties. There would be two properties, an on/off, and a property that has the path of the script to execute for each user.

      The Ambari Server would execute this script whenever a user is created, and it would log a message for each invocation:

      INFO: Executing /var/lib/ambari-server/resources/post-user-create.sh with arguments ['paul', 'users,operations'] succeeded
      ERROR: Executing /var/lib/ambari-server/resources/post-user-create.sh with arguments ['paul', 'users,operations'] failed with exit code 1 {"stdout": ''","stderr":"User hdfs not found"}

      Both the username and the list of groups the user is in would be past as $1, and $2 to the script. If the script has a non-zero exit code an ERROR is logged, otherwise an INFO level log is created with the script path and params.


        Issue Links



              lpuskas Laszlo Puskas
              paulcodding Paul Codding
              0 Vote for this issue
              2 Start watching this issue