【发布时间】:2023-02-03 18:35:11
【问题描述】:
我在 Jenkins Job Creation 中需要使用 Ansible 参数的帮助。我检查了很多文件,但帮助不大。
我检查了https://docs.ansible.com/ansible/latest/collections/community/general/jenkins_job_module.html 但没有得到需要在 templates/test.xml 中添加的内容?
- name: Create a jenkins job using basic authentication
community.general.jenkins_job:
config: "{{ lookup('file', 'templates/test.xml') }}"
name: test
password: admin
url: http://localhost:8080
user: admin
【问题讨论】:
-
在你的服务器上的 jenkins 工作树上看到那些
config.xml文件了吗?这是一个很好的起点。如果您不能直接访问树,使用 curl 或您最喜欢的浏览器获取http:///<USER>:<API_TOKEN>@your.jenkins.tld/job/JOBNAME/config.xml应该会为您提供相应的文件。
标签: jenkins ansible ansible-template