I need to run a script with a specific parameter.
I have created a template for this and placed it on the affected host.
After that I have created a user parameter configuration and allowed the script to be executed in the sudoers file.
If I run the script and specify the parameter "hardcoded", the script gives me the expected response.
I would, however, like to use a macro to pass the parameter.
In the template, I have created a user macro. {$TARGET_1} without a default value.
In the host context, I have set the appropriate value for the macro {$TARGET_1}.
Unfortunately, the value of the macro is not passed when I test/execute the item.
The user parameter looks like this:
What am I doing wrong?
I have created a template for this and placed it on the affected host.
After that I have created a user parameter configuration and allowed the script to be executed in the sudoers file.
If I run the script and specify the parameter "hardcoded", the script gives me the expected response.
I would, however, like to use a macro to pass the parameter.
In the template, I have created a user macro. {$TARGET_1} without a default value.
In the host context, I have set the appropriate value for the macro {$TARGET_1}.
Unfortunately, the value of the macro is not passed when I test/execute the item.
The user parameter looks like this:
Code:
UserParameter=item_key,cd /path/to/script && sudo ./script.sh {$TARGET_1}