From bc714c5ac86707619e5418abc398c1be95b3698f Mon Sep 17 00:00:00 2001 From: David Prevot Date: Mon, 31 Jul 2023 18:29:42 +0200 Subject: [PATCH] Prepare lxc-php82 on Bookworm (not yet by default) --- lxc-php/tasks/php82.yml | 21 +++++++++++++++++++-- lxc-php/templates/sury.sources.j2 | 8 ++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 lxc-php/templates/sury.sources.j2 diff --git a/lxc-php/tasks/php82.yml b/lxc-php/tasks/php82.yml index 8a292056..acb47f76 100644 --- a/lxc-php/tasks/php82.yml +++ b/lxc-php/tasks/php82.yml @@ -1,8 +1,14 @@ --- -- name: set APT keyring +- name: set APT keyring (Debian <12) ansible.builtin.set_fact: lxc_apt_keyring_dir: /etc/apt/trusted.gpg.d + when: ansible_distribution_major_version is version('12', '<') + +- name: set APT keyring (Debian >=12) + ansible.builtin.set_fact: + lxc_apt_keyring_dir: /etc/apt/keyrings + when: ansible_distribution_major_version is version('12', '>=') - name: "{{ lxc_php_version }} - Install dependency packages" community.general.lxc_container: @@ -15,7 +21,16 @@ regexp: 'bullseye/updates' replace: 'bullseye-security' -- name: "{{ lxc_php_version }} - Add sury repo" +- name: "{{ lxc_php_version }} - Add sury repo (Debian >=12)" + ansible.builtin.template: + src: sury.sources.j2 + dest: /etc/apt/sources.list.d/sury.sources + mode: "0644" + force: true + register: sury_sources + when: ansible_distribution_major_version is version('12', '>=') + +- name: "{{ lxc_php_version }} - Add sury repo (Debian <12)" ansible.builtin.lineinfile: dest: "{{ lxc_rootfs }}/etc/apt/sources.list.d/sury.list" line: "{{ item }}" @@ -25,6 +40,7 @@ loop: - "deb [signed-by={{ apt_keyring_dir }}/sury.gpg] https://packages.sury.org/php/ bullseye main" - "deb [signed-by={{ apt_keyring_dir }}/pub_evolix.asc] http://pub.evolix.org/evolix bullseye-php82 main" + when: ansible_distribution_major_version is version('12', '<') - name: "Ensure {{ lxc_rootfs }}{{ apt_keyring_dir }} directory exists" file: @@ -41,6 +57,7 @@ mode: "0644" owner: root group: root + when: ansible_distribution_major_version is version('12', '<') - name: copy packages.sury.org GPG Key ansible.builtin.copy: diff --git a/lxc-php/templates/sury.sources.j2 b/lxc-php/templates/sury.sources.j2 new file mode 100644 index 00000000..7d8a95c5 --- /dev/null +++ b/lxc-php/templates/sury.sources.j2 @@ -0,0 +1,8 @@ +# {{ ansible_managed }} + +Types: deb +URIs: https://packages.sury.org/php/ +Suites: {{ ansible_distribution_release }} +Components: main +Signed-by: {{ apt_keyring_dir }}/sury.gpg +Enabled: yes \ No newline at end of file