From 9b99d658c4727a523d8229cac9767a8ff4b0db01 Mon Sep 17 00:00:00 2001 From: administrator Date: Thu, 27 Aug 2026 00:07:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20playbooks/update=5Fexclusions.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playbooks/update_exclusions.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/playbooks/update_exclusions.yml b/playbooks/update_exclusions.yml index 1353227..12a3240 100644 --- a/playbooks/update_exclusions.yml +++ b/playbooks/update_exclusions.yml @@ -4,9 +4,8 @@ gather_facts: no vars: exclusions_url: "https://raw.githubusercontent.com/lib4u/amnezia-tunneling-ru/main/amnezia.json" - # альтернативный список: https://raw.githubusercontent.com/Internet-Helper/Unblock-for-Russia/main/for-AGH.txt - telegram_token: "{{ telegram_token }}" # задать в AWX как extra_var или credential - telegram_chat_id: "{{ telegram_chat_id }}" + telegram_token: "8820292312:AAECFO1AEWOJTh30zNuhyjC5C81o_qJHQcM" + telegram_chat_id: "407968638" tasks: - name: Download current exclusion list ansible.builtin.uri: @@ -14,13 +13,13 @@ return_content: yes register: exclusions_raw - - name: Extract domains from JSON (if JSON) + - 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 (if not JSON) + - 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 @@ -45,7 +44,7 @@ loop: "{{ domains }}" when: domains | length > 0 loop_control: - pause: 0.1 # небольшая задержка, чтобы не перегрузить CLI + pause: 0.1 changed_when: true - name: Restart VPN to apply changes @@ -53,11 +52,14 @@ cmd: "adguardvpn-cli disconnect && adguardvpn-cli connect" changed_when: true - - name: Send Telegram notification - community.general.telegram: - token: "{{ telegram_token }}" - api_args: + - name: Send Telegram notification via API + 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 }} доменов." + 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