27 lines
		
	
	
		
			772 B
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			772 B
		
	
	
	
		
			YAML
		
	
	
	
	
	
| ---
 | |
| - name: Make an HTTPS API call with basic auth
 | |
|   hosts: localhost
 | |
|   gather_facts: no
 | |
| 
 | |
|   tasks:
 | |
|     - name: Make API call
 | |
|       uri:
 | |
|         #url: "https://192.168.1.1/api/dhcpv4/leases/searchLease/"
 | |
|         #url: "{{ API_URL }}/dhcpv4/leases/searchLease/"
 | |
|         #url: "{{ API_URL }}/core/system/status"
 | |
|         #url: "{{ API_URL }}/core/menu/search/?=1725020077211"
 | |
|         url: "{{ API_URL }}/dhcpv4/service/status/"
 | |
|         #https://192.168.1.1/api/core/menu/search/?_=1725020077211
 | |
|         method: GET
 | |
|         user: "{{ API_KEY }}"
 | |
|         password: "{{ API_SECRET }}"
 | |
|         force_basic_auth: yes
 | |
|         validate_certs: no
 | |
|         return_content: yes
 | |
|       register: api_response
 | |
| 
 | |
|     - name: Print API response
 | |
|       debug:
 | |
|         var: api_response.content
 | |
| 
 |