You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/uri/tasks/use_netrc.yml

44 lines
1020 B
YAML

- name: Write out netrc
copy:
dest: "{{ remote_tmp_dir }}/netrc"
content: |
machine {{ httpbin_host }}
login foo
password bar
- name: Test with netrc forced Basic auth
uri:
url: https://{{ httpbin_host }}/basic-auth/foo/bar
return_content: yes
headers:
Authorization: Bearer foobar
environment:
NETRC: "{{ remote_tmp_dir }}/netrc"
register: response
- name: assert Test with netrc forced Basic auth
assert:
that:
- response.json.user == 'foo'
- name: Test Bearer authorization is successful with use_netrc=False
uri:
url: https://{{ httpbin_host }}/bearer
use_netrc: false
return_content: yes
headers:
Authorization: Bearer foobar
environment:
NETRC: "{{ remote_tmp_dir }}/netrc"
register: response
- name: assert Test Bearer authorization is successful with use_netrc=False
assert:
that:
- response.json.token == 'foobar'
- name: Clean up
file:
dest: "{{ remote_tmp_dir }}/netrc"
state: absent