How to update Windows environment variables after Ansible's win_environment module? - windows

I am using Ansible to configure our Windows Servers 2012.
I am using Ansible's Windows modules: win_xxx. All modules are working fine except for
win_environment
win_path
I think the win_path depends win_environment module in my case.
I am installing
JDK
Apache Ant
Apache Tomcat8.
Installation works fine and setting up the environment variables for
JAVA_HOME
ANT_HOME
is not working as expected. The server is not updated with the new environment variables. I need to sign out and sign in back to the server in order the new variables are updated. Is there any way to update the system in Ansible or in Windows Batch/Powershell without signing in and out?

just to remind that "User level environment" variables will be set, but not available until the user has logged off and on again.
check then either you have selected "user" as level on you win_environment module.

Related

Unable to Install WebSphere Developer Tools (WDT)

I've downloaded https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/pot/LibertyPoT_17.0.0.1_WIN.zip but I'm stuck at step 1 of section "0.5 Install WebSphere Developer Tools (WDT)" in setup.pdf where I see
Am I doing something wrong?
Double-check paragraph at 0.3 Installing Liberty and the Java Runtime and its note:
To install for windows or linux,
a. Liberty is already installed for you {LAB_HOME)/wlp
b. The IBM JRE is already installed for you
{LAB_HOME)/wlp/java [...]
c. The IBM_JRE is set to default Java in
the {LAB_HOME)/wlp/etc/server.env
If you want to override this for a specific server create a server.env
file in the usr/servers/ directory.
*Note: If JAVA_HOME is already set in your shell, then you will need to “unset JAVA_HOME”. To check, execute “env| grep –i java_home”. If
it returns with a value, then execute “unset JAVA_HOME”
Then remind that Eclipse looks for jre/jdk based on vm parameter in eclipse.ini.
In the zip file downloaded it should be
-vm ..\wlp\java\bin\javaw.exe
It should be correct, anyway you could try setting an absolute path so you are sure it doesn't care about working directory.

Where to write set JAVA_OPTS in setenv.bat for tomcat 7 windows installation (as a service)

There are various similar questions but none answers where to embed the environment variable. Unfortunately, in my case there is already a file named setenv.bat which contains a lot of code.
There is a lot of code in it. So the question is where do I write (on which line at what place within setenv.bat)
set "JAVA_OPTS=%JAVA_OPTS% -Dblockchain.callbackUrl=http://example.com/"
I wrote it at the beginning of setenv.bat but it doesn't work.
FYI : I installed tomcat using the windows installer, hence, I have tomcat7w.exe
I'm running tomcat as a windows service
I'm trying to access this variable through Spring in my webapp as :
#Value("#{systemProperties['blockchain.callbackUrl']?:'http://localhost:8080/'}")
private String callbackHost;
Update
I tried setting it in catalina.bat, still didn't worked.
When we create a service from Tomcat installation on windows, such parameters have to be defined in service.bat before installing the service with service.bat install command.
--JvmOptions "-Dblockchain.callbackUrl=http://www.example.com/;-Dcatalina.home=%CATALINA_HOME
Add the environment variables to JvmOptions in service.bat as shown above.

IBM Worklight - Windows - "'WEBWORKS_HOME' environment variable is undefined"

From the BlackBerry development tutorial I know that first I need to install the BlackBerry 10 WebWorks SDK and then set create a WEBWORKS_HOME environment variable with the SDK path.
I do not how to create the environment variable in Eclipse. I set it through Computer-> Properties-> Advanced Settings-> Environment Variables-> User Variables but it did not worked.
When I add a BlackBerry 10 environment to my application, it gives the following error in the Eclipse Worklight console:
E: blackberry10 build failed: The 'WEBWORKS_HOME' environment variable is undefined. See Worklight Information Center for details.
The environment variable is created in the manner you have described - a dedicated environment variable with the name WEBWORKS_HOME and the value, for example: C:\Program Files\Research In Motion\BlackBerry 10 WebWorks SDK 1.0.4.11.
There is no need to create it in Eclipse
You can check that it correctly exists by opening a CMD window and typing set
Re-start Eclipse and the Build operation should now pass for the BlackBerry 10 environment.

PostgreSQL environment file on Mac OSX?

PostgreSQL seems to have an environment file that allows settings environment variables. On Linux (Kubuntu 11.10 in my case), it is located at e.g. /etc/postgresql/8.4/main/environment and empty by default, apart from a few helpful comments.
On Mac OSX Lion, the file does not seem to exist: I would expect it at e.g. /Library/PostgreSQL/9.0/data/ as that's where all the other configuration files are, but it is not there - and if I create it, it does not seem to be used.
How can I set environment variables for the PostgreSQL server on Mac OSX ?
There is no standard way to specify environment variables for PostgreSQL, I assume that file is Kubuntu specific.
What I did to ease my life was copying approach used by ORACLE:
I have /etc/pgtab file on each server where I run PostgreSQL databases;
I specify each cluster I run on a single line in the /etc/pgtab;
I've created a script pgenv which based on the /etc/pgtab shows the menu of clusters (in case there're more then just one) and initialize all PATHs and variables.
It works on my MacBookPro and on all Linux and HP-UX based servers.

System environment variable created during install not available to current user until reboot

I have a msi package generated by wix that creates a system environment variable by populating the Environment table.
<Environment Id="CreateEnvVar" Name="DATADIR" Action="set"
System="yes" Part="all" Value="[DATA_DIR]" />
The install successfully creates the environment variable at the system level. This was verified by viewing the Environment Variables dialog from System Properties
However the currently logged in user does not have access to the newly created environment variables until the machine is rebooted ( I'm assuming that logging out then back in would also work. Just have not tried it yet). Executing an application that was just installed fails because it does not have access to the DATADIR variable.
Also, opening up a command prompt after the installation is complete the DATADIR variable does not appear when executing the set command.
I understand that a process started before executing the MSI would not get the new variables. However, why wouldn't a process started after the environment variables are added get the new ones?
FYI, I am installing on Windows Server 2003 and I am logged in through remote desktop with a user in the Administrators group.
Are you installing via Remote Desktop? If so, ensure you are using the admin console session.
To do so, launch Remote Desktop using:
mstsc /admin
Or if you are using the latest version of RDP, it is now:
mstsc /console
Try installing it from this session (or locally) and let me know the result.

Resources