status_code的状态代码范围



Ansible 2.9.6

当我将状态代码指定为列表时,该剧本运行良好。

---
- hosts: localhost
tasks:
- name: Create a new bitbucket repository
uri:
user: "{{username}}"
password: "{{password}}"
method: POST
body_format: json
body: "{{ lookup('file','create-repo.json')}}"
return_content: yes
status_code: [200,201,400,401,403,409,500]
force_basic_auth: yes
validate_certs: no
url: "{{url}}"
register: bitbucketResponse
- name: show bitbucket reponse
debug:
msg: "{{bitbucketResponse}}"
...

我想指定一个范围(200到500(,但我不知道它是否受支持,例如:status_code:[200:500]

可以使用范围。例如

status_code: "{{ range(200, 500, 1)|list }}"

最新更新