Обновить playbooks/update_exclusions.yml
This commit is contained in:
@@ -1,33 +1,16 @@
|
|||||||
---
|
---
|
||||||
- name: Update AdGuard VPN exclusions
|
- name: Add core Russian domains to AdGuard VPN exclusions
|
||||||
hosts: all
|
hosts: your_nuc
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
exclusions_url: "https://raw.githubusercontent.com/lib4u/amnezia-tunneling-ru/main/amnezia.json"
|
|
||||||
telegram_token: "8820292312:AAECFO1AEWOJTh30zNuhyjC5C81o_qJHQcM"
|
telegram_token: "8820292312:AAECFO1AEWOJTh30zNuhyjC5C81o_qJHQcM"
|
||||||
telegram_chat_id: "407968638"
|
telegram_chat_id: "407968638"
|
||||||
|
domains_list:
|
||||||
|
- gosuslugi.ru
|
||||||
|
- vk.com
|
||||||
|
- mail.ru
|
||||||
|
# ... (вставьте сюда все домены из списка выше) ...
|
||||||
tasks:
|
tasks:
|
||||||
- name: Download current exclusion list
|
|
||||||
ansible.builtin.uri:
|
|
||||||
url: "{{ exclusions_url }}"
|
|
||||||
return_content: yes
|
|
||||||
register: exclusions_raw
|
|
||||||
|
|
||||||
- name: Extract domains from JSON (amnezia.json format)
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
domains: "{{ exclusions_raw.content | from_json | json_query('domains') }}"
|
|
||||||
when: exclusions_raw.content | from_json | type_debug == 'dict'
|
|
||||||
ignore_errors: yes
|
|
||||||
|
|
||||||
- name: Extract domains from plain text (fallback)
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
domains: "{{ exclusions_raw.content | split('\n') | reject('match', '^#') | reject('match', '^$') | list }}"
|
|
||||||
when: domains is not defined
|
|
||||||
|
|
||||||
- name: Count domains
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "Found {{ domains | length }} domains to exclude"
|
|
||||||
|
|
||||||
- name: Clear existing exclusions
|
- name: Clear existing exclusions
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: adguardvpn-cli site-exclusions clear
|
cmd: adguardvpn-cli site-exclusions clear
|
||||||
@@ -41,8 +24,7 @@
|
|||||||
- name: Add each domain as exclusion
|
- name: Add each domain as exclusion
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "adguardvpn-cli site-exclusions add {{ item }}"
|
cmd: "adguardvpn-cli site-exclusions add {{ item }}"
|
||||||
loop: "{{ domains }}"
|
loop: "{{ domains_list }}"
|
||||||
when: domains | length > 0
|
|
||||||
loop_control:
|
loop_control:
|
||||||
pause: 0.1
|
pause: 0.1
|
||||||
changed_when: true
|
changed_when: true
|
||||||
@@ -52,14 +34,13 @@
|
|||||||
cmd: "adguardvpn-cli disconnect && adguardvpn-cli connect"
|
cmd: "adguardvpn-cli disconnect && adguardvpn-cli connect"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|
||||||
- name: Send Telegram notification via API
|
- name: Send Telegram notification
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "https://api.telegram.org/bot{{ telegram_token }}/sendMessage"
|
url: "https://api.telegram.org/bot{{ telegram_token }}/sendMessage"
|
||||||
method: POST
|
method: POST
|
||||||
body_format: json
|
body_format: json
|
||||||
body:
|
body:
|
||||||
chat_id: "{{ telegram_chat_id }}"
|
chat_id: "{{ telegram_chat_id }}"
|
||||||
text: "✅ Список исключений обновлён. Добавлено {{ domains | length }} доменов."
|
text: "✅ Список исключений обновлён. Добавлено {{ domains_list | length }} ключевых доменов."
|
||||||
disable_web_page_preview: yes
|
disable_web_page_preview: yes
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
when: telegram_token is defined and telegram_chat_id is defined
|
|
||||||
Reference in New Issue
Block a user