-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuri-playbook01.yml
More file actions
37 lines (32 loc) · 1.03 KB
/
uri-playbook01.yml
File metadata and controls
37 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
- name: get-url Download the protected file
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Access the website and make sure the url is live
ansible.builtin.uri:
method: GET
url: http://10.10.2.4/admin/secure.txt
status_code: 401
return_content: true
register: validateurl
- name: "INFO: HTTP Response for the URL"
ansible.builtin.debug:
var: validateurl.msg
- name: Access the same url with basic authentication and download the file
ansible.builtin.uri:
method: GET
url: http://10.10.2.4/admin/secure.txt
status_code: 200
return_content: yes
url_username: sammy
url_password: larry
register: validateurl
- name: Show that the content was still retreived
ansible.builtin.debug:
var: validateurl.content
- name: Put secret content into a file
ansible.builtin.copy:
content: "{{ validateurl.content }}"
dest: ~/ansible-downloaded-the-secret-file.txt