diff --git a/UpdateAdGuardBlacklist.yml b/UpdateAdGuardBlacklist.yml index b218813..b2820a5 100644 --- a/UpdateAdGuardBlacklist.yml +++ b/UpdateAdGuardBlacklist.yml @@ -4,21 +4,36 @@ gather_facts: no # Disable gathering facts tasks: + - name: Fetch authentication token + uri: + url: "http://192.168.51.201/control/login" + method: POST + body_format: json + body: + name: "joshlaymon" + password: "1993llelMO65026" + return_content: yes + validate_certs: no + register: login_response + + - name: Extract session token + set_fact: + session_token: "{{ login_response.json.api_token }}" + - name: Update DNS blacklists uri: - url: "https://dns1.lan/api/dnsblacklist/update" + url: "http://192.168.51.201/control/update_dns_blacklist" method: POST body_format: json body: blacklist_urls: - - "https://example.com/blacklist.txt" - - "https://anotherexample.com/blacklist.txt" + - https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt headers: - Authorization: "Bearer YOUR_API_TOKEN" + X-Auth-Token: "{{ session_token }}" status_code: 200 validate_certs: no register: update_response - name: Check update response debug: - var: update_response + var: update_response \ No newline at end of file