本文最后更新于 420 天前,其中的信息可能已经过时,如有错误请发送邮件到 wuxianglongblog@163.com
参数 |
描述 |
config string |
xml 配置文件,如果 job 作业不存在时,需要设置本参数 |
enable boolean |
作业是否启用 |
name string required |
作业名称 |
password string |
连接 jenkins 服务器认证使用的密码 |
state string |
指定作业是否创建或删除,可选值,present 默认、absent |
token string |
API 令牌 |
url string |
Jenkins 服务器的 URL |
user string |
连接 jenkins 服务器的用户名 |
validate_certs boolean |
是否验证 SSL 证书,默认 yes |
| - 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 |
| |
| - name: Create a jenkins job using the token |
| community.general.jenkins_job: |
| config: "{{ lookup('template', 'templates/test.xml.j2') }}" |
| name: test |
| token: asdfasfasfasdfasdfadfasfasdfasdfc |
| url: http://localhost:8080 |
| user: admin |
| |
| - name: Delete a jenkins job using basic authentication |
| community.general.jenkins_job: |
| name: test |
| password: admin |
| state: absent |
| url: http://localhost:8080 |
| user: admin |
| |
| - name: Delete a jenkins job using the token |
| community.general.jenkins_job: |
| name: test |
| token: asdfasfasfasdfasdfadfasfasdfasdfc |
| state: absent |
| url: http://localhost:8080 |
| user: admin |
| |
| - name: Disable a jenkins job using basic authentication |
| community.general.jenkins_job: |
| name: test |
| password: admin |
| enabled: false |
| url: http://localhost:8080 |
| user: admin |
| |
| - name: Disable a jenkins job using the token |
| community.general.jenkins_job: |
| name: test |
| token: asdfasfasfasdfasdfadfasfasdfasdfc |
| enabled: false |
| url: http://localhost:8080 |
| user: admin |