Accessing environmental variables on rundeck node

2019-07-24 18:31发布

This is a two-part question. I am running a script using rundeck that depends on access to environmental variables system-wide on the node I'm executing the script on that I have set in /etc/environment.

First, how do I get rundeck to ingest the system environment? I can't find any option in rundeck to do this.

Second, why doesn't this happen by default? I'm under the impression that rundeck works through ssh; shouldn't the system environment be loaded every time it logs in to the node?

标签: unix rundeck
1条回答
Ridiculous、
2楼-- · 2019-07-24 19:15

First, how do I get rundeck to ingest the system environment? I can't find any option in rundeck to do this.

I succeeded to perform this by adding the following lines to:

set -a
. /etc/environment
. /etc/profile

1) put those lines into the file: /etc/rundeck/profile

2) put those lines into a script step

Remark: I'm using only script steps in my rundeck and I'm always put this lines in the first line of the script step:

#!/usr/bin/env bash

Second, why doesn't this happen by default? I'm under the impression that rundeck works through ssh; shouldn't the system environment be loaded every time it logs in to the node?

I think that you need to cinfigre something in the ssh_config file. check this link: Rundeck not setting up environment variable for remote execution with different ssh port

查看更多
登录 后发表回答