How to use configuration environment files with ctm.yaml in control-m

71 Views Asked by At

I want to send to different email recipients when my job is ok for distinct environments (test, prod) pro example. Currently i use a folder env_files/* with prod_env.conf, test_env.conf, so inside these file are variables such export VAULT_TYPE=SOMETYPE etc.. I added to my conf files: export [email protected] and tried to use that variable into my ctm.yaml.

That is, I tried to call the variable in my ctm.yaml using distinct ways such %%GETENV EMAIL_ENV, ${EMAIL_ENV} or %%EMAIL_ENV, for example:

mailToTeam: Type: Action:Mail Subject: Job %%JOBNAME Success Message: Job %%JOBNAME success in ${RUNTIME_ENV}, ${EMAIL_ENV} To: ${EMAIL_ENV}

But neither of variation to call the variable EMAIL_ENV to use the placeholder in my ctm.yaml works. In overall, how can i use the variables defined in my conf files into my ctm.yaml?

Thanks in advance.

1

There are 1 best solutions below

0
Mark On

What kind of error are you getting? If you see "CTMERR" then that means the error is at the Control-M level and the variable is not being resolved there.

With this kind of requirement (i.e. basic static variables) I'd be tempted to use the LIBMEMSYM facility and have different LIBMEMSYM files defined for Prod, Test, etc.

The LIBMEMSYM is a text file that you define in the job or at Smart Folder level. The text file needs to be readable by the Control-M jobs and is usually kept on the Control-M Server itself.

E.g. in your Test job, in the Variables, define LIBMEMSYM with /cmserver/variables/libmemsym/test.txt and the file contents as -

%%[email protected]
%%SERVER=TEST1_SRV
%%DB=DB_TST54

and /cmserver/variables/libmemsym/prod.txt as -

%%[email protected]
%%SERVER=PR1_SRV
%%DB=DB_PRD81

The only difference between the 2 jobs (or smart folders) is the LIBMEMSYM definition.