0
使用下面的代码(如事实上artifactory的),以反复访问REST端点:Ansible:URI模块忽略状态代码
- name: create local snapshots repositories
uri:
url: "{{ api_endpoint }}/repositories/{{ item }}-local-snapshots"
method: PUT
user: 'username'
password: 'somepass'
body: "{{ local_snapshots_repo_json|to_json }}"
force_basic_auth: yes
body_format: json
return_content: yes
status_code: 200, 400
register: result
changed_when: result.status == 400
with_items: "{{ projects }}"
然而,不管我在changed_when
控制使用时,任务不会导致更改(例如,changed_when == 400
或changed_when != 400
或changed_when != 'foo'
)。
有什么建议吗?