I am writing some salt stack formulas which will install tomcat package. but after installation I have to set JAVA_HOME in /etc/default/tomcat7 file. Is there any option to set JAVA_HOME? Or is there any option to modify or add JAVA_HOME in environment variable (i.e. in .bashrc or .profile files)?
My pillar.example file will have these details:
tomcat_version: 7
java_home: '/usr/lib/jvm/java-7-oracle'
As an alternative to setting .bashrc or .profile, you could simply set the JAVA_HOME value directly in /etc/default/tomcat7
:
tomcat_configuration:
file.append:
- name: /etc/default/tomcat7
- text: export JAVA_HOME={{ pillar['java_home'] }}
If for some reason file.append
is not suitable, salt offers file.replace and (new in 0.18.0) file.blockreplace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With