--- - name: Update DNS blacklists on AdGuard hosts: all # Apply playbook to all hosts 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: Debug login response debug: var: login_response - name: Set session token fact set_fact: session_token: "{{ login_response.json.token | default('') }}" - name: Update DNS blacklists uri: 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" headers: X-Auth-Token: "{{ session_token }}" status_code: 200 validate_certs: no register: update_response - name: Check update response debug: var: update_response