Issue #94: Try to get new deb822_repository task to work properly.

This commit is contained in:
Jeff Geerling 2025-01-29 23:39:19 -06:00
parent 26cba968b8
commit b09afd41d1
2 changed files with 13 additions and 5 deletions

View File

@ -8,7 +8,7 @@ galaxy_info:
company: "Midwestern Mac, LLC"
license: "MIT"
issue_tracker_url: https://github.com/geerlingguy/ansible-role-php-versions/issues
min_ansible_version: 2.10
min_ansible_version: 2.15
platforms:
- name: Debian
versions:

View File

@ -11,10 +11,11 @@
- python3-debian
state: present
# Huge thanks to https://www.jeffgeerling.com/comment/34112#comment-34112
- name: Make API request to Launchpad
uri:
url: "https://api.launchpad.net/devel/~ondrej/+archive/ubuntu/php"
return_content: yes
return_content: true
method: GET
headers:
Accept: "application/json"
@ -24,6 +25,13 @@
ansible.builtin.set_fact:
signing_key_fingerprint: "{{ launchpad_response.json.signing_key_fingerprint }}"
- name: Retrieve ASCII representation of the key using the signing key fingerprint
uri:
url: "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{ signing_key_fingerprint }}"
return_content: true
method: GET
register: keyserver_response
- name: Add Ondrej's PHP PPA
become: true
ansible.builtin.deb822_repository:
@ -33,14 +41,14 @@
uris: [https://ppa.launchpadcontent.net/ondrej/php/ubuntu]
suites: ["{{ ansible_facts['distribution_release'] }}"]
components: [main]
signed_by: "{{ signing_key_fingerprint }}"
signed_by: "{{ keyserver_response.content }}"
register: php_ondrej_debian_repo
- name: Update apt caches after repo is added (Debian).
- name: Update apt caches after repo is added.
apt: update_cache=true
when:
- php_ondrej_debian_repo.changed
- ansible_distribution == "Debian"
- ansible_os_family == "Debian"
tags: ['skip_ansible_lint']
- name: Purge PHP version packages (besides the currently chosen php_version).