最近刚开始使用 Ansible,我遇到了一个问题。在我的 YAML 结构之一中,我定义了如下内容:
---
# file: main.yml
#
# Jenkins variables for installation and configuration
jenkins:
debian:
# Debian repository containing Jenkins and the associated key for accessing the repository
repo: 'deb http://pkg.jenkins-ci.org/debian binary/'
repo_key: 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key'
# Dependencies needed for Jenkins to run properly
dependencies:
- 'openjdk-7-jdk'
- 'git-core'
- 'curl'
port: 8080
# Installation directory
home: '/opt/jenkins'
# Path to the location of the main Jenkins-cli binary
bin_path: '{{jenkins.home}}/jenkins-cli.jar'
# Path to the location of the Jenkins updates file
updates_path: '{{jenkins.home}}/updates_jenkins.json'
Ansible 在特定任务中给了我这样的错误:
“在模板字符串中检测到递归循环:{{jenkins.home}}/updates_jenkins.json”
我已将其缩小到问题在于 bin_path 和 updates_path 都指的是“家”这一事实。有没有解决的办法?我需要多次定义“/opt/jenkins”,这有点糟糕。