Ansible/UpdateAdGuardBlacklist.yml

39 lines
1.0 KiB
YAML

---
- name: Update DNS blacklists on AdGuard
hosts: all
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: "http://192.168.51.201/control/update_dns_blacklist"
method: POST
body_format: json
body:
blacklist_urls:
- https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
headers:
X-Auth-Token: "{{ session_token }}"
status_code: 200
validate_certs: no
register: update_response
- name: Check update response
debug:
var: update_response