lvicainne / puppet-bashrc

Puppet module for managing BashRC files
Other
4 stars 6 forks source link

Add ability to modify the ~/.bash_profile for users #6

Open bschonec opened 2 years ago

bschonec commented 2 years ago

I have a great need to modify the .bash_profile for individual users. I am working on a pull request but would like feedback on how to implement such a feature.

I was thinking about adding a key in the bashrc::users variable called 'bashprofile' and then have the puppet template iterate over all of the key/pair values. Of course, there wouldn't be any kind of sanity checking doing it this way.

bashrc::users:       
  - username: "SomeUserName"
    managelocalbashrc: true
    homedirectory: "/home/SomeUserName"
    bashprofile:  
      export:        
        - JAVA_HOME: /foo/bar
        - JBOSS_HOME: /fee/bar

templates/skel/profile.erb additions:

<% @key['bashprofile']['export'].each do |k| -%>
export <%= k %>=<%= k.keys %>  value:    
<% end -%>

This PR gives an example of what I'm thinking.

This module comes up as the first or second hit when searching for 'puppet module bash_profile'.

Thoughts?

lvicainne commented 2 years ago

Hi ! As you notice, this project is not currently under a heavy dvelopment. Feel free to propose your PR and I will merge it as long as it is runnable :) I think your proposal is quite interesting ! Kr