我在跑脚本的时候发现pipeline的参数传不到ansible playbook里面,望求大神解决。
pipeline代码大概是这样的:
pipeline {
agent any
parameters {
choice(name: 'ABC', choices: 'one
two
three', description: 'test parms')
}
stages {
stage('Build') {
steps {
echo 'Building start...'
echo "${params.ACTION}"
}
}
}
stage('ansible tower'){
steps {
ansibleTower credential: '',
extraVars: "ABC: ${params.ABC}",
importTowerLogs: true,
importWorkflowChildLogs: false,
inventory: '',
jobTags: '',
jobTemplate: '10001',
jobType: 'run',
limit: '',
removeColor: false,
skipJobTags: '',
templateType: 'job',
throwExceptionWhenFail: false,
towerServer: 'Ansible',
verbose: false
}
}
}
}
ansible playbook代码是这样的:
问题:
如何通过pipeline定义的参数ABC让ansible roles读取到ABC的变量
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…