Rundeck not setting up environment variable for remote execution with different ssh port

后端 未结 2 1608
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-27 00:38

Rundeck setsup all the options passed to a job as environment variable like $RD_OPTION_* but it is not setting up those variables when a job is executed in remote n

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-27 01:17

    I think you mixed up Rundeck commands arguments and Rundeck environment variables

    This is a "Commands, Script Arguments and Job Reference Arguments": ${job.execid}

    As its name states, you can use it as a commands arguments. Just like what you did in your job definition.

    This is a "Environment Variables": $RD_JOB_EXECID

    Without any setup, both work fine if you are running the job on Rundeck server itself, but if you want to dispatch your job to a node, $RD_JOB_EXECID will not work out of box.

    To pass environment variables through remote command dispatches, it is required to properly configure the SSH server on the remote end. See the AcceptEnv directive in the "sshd_config(5)" manual page for instructions.

    Use a wild card pattern to permit RD_ prefixed variables to provide open access to Rundeck generated environment variables.

     Example in sshd_config:
    
     # pass Rundeck variables 
     AcceptEnv RD_*
    

    Rundeck SSH Plugins

    On Rundeck Server

    Make sure you have SendEnv RD_* set in ssh_config

    For your usecase, ${job.execid},${option.option1} would works perfect with out mess around with sshd_config


    It DOES work on differect SSH port.

    Job Definition in XML

    
      
        
          
            
        
        
        
          true
          false
          ascending
          1
        
        true
        TEST
        63b6f283-39b2-479d-bba9-b1742bc2ea53
        INFO
        test rundeck job context
        
          ${option.nodeFilter}
        
        true
        true
        
          
            
             ">${job.execid}< >$RD_JOB_EXECID<"
          
          
            
            
          
        
        63b6f283-39b2-479d-bba9-b1742bc2ea53
      
    
    

提交回复
热议问题