diff --git a/playbooks/update_exclusions.yml b/playbooks/update_exclusions.yml index 4325052..96e9e3a 100644 --- a/playbooks/update_exclusions.yml +++ b/playbooks/update_exclusions.yml @@ -1,33 +1,16 @@ --- -- name: Update AdGuard VPN exclusions - hosts: all +- name: Add core Russian domains to AdGuard VPN exclusions + hosts: your_nuc gather_facts: no vars: - exclusions_url: "https://raw.githubusercontent.com/lib4u/amnezia-tunneling-ru/main/amnezia.json" telegram_token: "8820292312:AAECFO1AEWOJTh30zNuhyjC5C81o_qJHQcM" telegram_chat_id: "407968638" + domains_list: + - gosuslugi.ru + - vk.com + - mail.ru + # ... (вставьте сюда все домены из списка выше) ... 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 ansible.builtin.command: cmd: adguardvpn-cli site-exclusions clear @@ -41,8 +24,7 @@ - name: Add each domain as exclusion ansible.builtin.command: cmd: "adguardvpn-cli site-exclusions add {{ item }}" - loop: "{{ domains }}" - when: domains | length > 0 + loop: "{{ domains_list }}" loop_control: pause: 0.1 changed_when: true @@ -52,14 +34,13 @@ cmd: "adguardvpn-cli disconnect && adguardvpn-cli connect" changed_when: true - - name: Send Telegram notification via API + - name: Send Telegram notification ansible.builtin.uri: url: "https://api.telegram.org/bot{{ telegram_token }}/sendMessage" method: POST body_format: json body: chat_id: "{{ telegram_chat_id }}" - text: "✅ Список исключений обновлён. Добавлено {{ domains | length }} доменов." + text: "✅ Список исключений обновлён. Добавлено {{ domains_list | length }} ключевых доменов." disable_web_page_preview: yes - delegate_to: localhost - when: telegram_token is defined and telegram_chat_id is defined \ No newline at end of file + delegate_to: localhost \ No newline at end of file