From 64fac3161f95eaf08942c0e966a69974aff428f8 Mon Sep 17 00:00:00 2001 From: Vitaliy Kukharik Date: Tue, 12 Mar 2024 10:02:57 +0000 Subject: [PATCH] apt_repository_and_key -> apt_repository --- README.md | 2 +- roles/add-repository/tasks/main.yml | 31 ++++++++++------------------- vars/Debian.yml | 20 +++++-------------- 3 files changed, 16 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 409de6477..ea24b5a96 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ _Table of results of daily automated testing of cluster deployment:_ ###### Ansible version -Minimum supported Ansible version: 2.15.0 +Minimum supported Ansible version: 8.0.0 (ansible-core 2.15.0) ## Requirements This playbook requires root privileges or sudo. diff --git a/roles/add-repository/tasks/main.yml b/roles/add-repository/tasks/main.yml index 138971e50..af1d0f026 100644 --- a/roles/add-repository/tasks/main.yml +++ b/roles/add-repository/tasks/main.yml @@ -11,18 +11,18 @@ delay: 5 retries: 3 - - name: Add repository and repository apt-key + - name: Add repository ansible.builtin.deb822_repository: - name: "{{ item.repo | replace('.', '-') | replace('/', '-') }}" + name: "{{ item.repo.split('//')[1].split('/')[0] }}" types: [deb] uris: "{{ item.repo.split(' ')[1] }}" - signed_by: "{{ item.key | default('') }}" + signed_by: "{{ item.key | default(omit) }}" suites: "{{ item.repo.split(' ')[2] }}" components: "{{ item.repo.split(' ')[3] }}" state: present enabled: true - loop: "{{ apt_repository_and_key }}" - when: apt_repository_and_key | length > 0 + loop: "{{ apt_repository }}" + when: apt_repository | length > 0 - name: Update apt cache ansible.builtin.apt: @@ -188,25 +188,14 @@ # timescaledb (if enable_timescale is defined) - block: # Debian based - - name: Make sure the python3-debian package is present - ansible.builtin.apt: - pkg: - - python3-debian - state: present - register: apt_status - until: apt_status is success - delay: 5 - retries: 3 - when: ansible_os_family == "Debian" - - name: Add TimescaleDB repository ansible.builtin.deb822_repository: - name: "{{ timescale_repository | replace('.', '-') | replace('/', '-') }}" + name: "timescaledb" types: [deb] - uris: "{{ timescale_repository.split(' ')[1] }}" - signed_by: "{{ timescale_repository_key }}" - suites: "{{ timescale_repository.split(' ')[2] }}" - components: "{{ timescale_repository.split(' ')[3] }}" + uris: "https://packagecloud.io/timescale/timescaledb" + signed_by: "https://packagecloud.io/timescale/timescaledb/gpgkey" + suites: "{{ ansible_distribution_release }}" + components: "[main]" state: present enabled: true when: ansible_os_family == "Debian" diff --git a/vars/Debian.yml b/vars/Debian.yml index 5470b38d6..a9ac3b53c 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -17,23 +17,13 @@ postgresql_home_dir: "/var/lib/postgresql" postgresql_stats_temp_directory_path: "/var/lib/pgsql_stats_tmp" # or 'none' postgresql_stats_temp_directory_size: "1024m" -# Repository and key for Debian >= 12 version -apt_repository_and_key: - - repo: "deb https://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main" # postgresql apt repository - key: "https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc" # postgresql repository apt key - -# Repository and key for Debian < 12 version -apt_repository_keys: - - key: "https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc" # postgresql repository apt key +# Repository apt_repository: - repo: "deb https://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main" # postgresql apt repository -# - repo: "deb https://deb.debian.org/debian/ {{ ansible_distribution_release }} main" # debian repo (optional) -# - repo: "deb https://deb.debian.org/debian/ {{ ansible_distribution_release }}-updates main" # debian repo (optional) -# - repo: "deb https://security.debian.org/debian-security/ {{ ansible_distribution_release }}/updates main" # debian repo (optional) - -timescale_server: "https://packagecloud.io/timescale/timescaledb" -timescale_repository: "deb {{ timescale_server }}/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} main" -timescale_repository_key: "{{ timescale_server }}/gpgkey" + key: "https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc" # postgresql apt repository key +# - repo: "deb https://deb.debian.org/debian/ {{ ansible_distribution_release }} main" +# - repo: "deb https://deb.debian.org/debian/ {{ ansible_distribution_release }}-updates main" +# - repo: "deb https://security.debian.org/debian-security/ {{ ansible_distribution_release }}/updates main" # Packages (for apt repo) os_specific_packages: