Setting environment variables with puppet

前端 未结 5 2066
离开以前
离开以前 2021-02-05 22:36

I\'m trying to work out the best way to set some environment variables with puppet.

I could use exec and just do export VAR=blah. However, that would only

5条回答
  •  故里飘歌
    2021-02-05 22:58

    I would take a look at this related question.

    *.sh scripts in /etc/profile.d are read at user-login time (as the post says, at the same time /etc/profile is sourced)

    Variables export-ed in any script placed in /etc/profile.d will therefore be available to your users.

    You can then use a file resource to ensure this action is idempotent. For example:

    file { "/etc/profile.d/my_test.sh":
      content => 'export MYVAR="123"'
    }
    

提交回复
热议问题