|
3 | 3 | set_fact: |
4 | 4 | php_opcache_conf_filename: "10-opcache.ini" |
5 | 5 |
|
6 | | -- name: Ensure dirmngr is installed (gnupg dependency). |
7 | | - apt: |
8 | | - name: dirmngr |
9 | | - state: present |
10 | | - |
11 | | -- name: Add repository for PHP versions (Ubuntu). |
12 | | - apt_repository: repo='ppa:ondrej/php' |
13 | | - when: ansible_distribution == "Ubuntu" |
14 | | - |
15 | | -# Debian-specific tasks. |
16 | | -- name: Add dependencies for PHP versions (Debian). |
| 6 | +- name: Add dependencies for PHP versions. |
17 | 7 | apt: |
18 | 8 | name: |
19 | 9 | - apt-transport-https |
20 | 10 | - ca-certificates |
| 11 | + - python3-debian |
21 | 12 | state: present |
22 | | - when: ansible_distribution == "Debian" |
23 | | - |
24 | | -- name: Add Ondrej Sury's apt key (Debian). |
25 | | - apt_key: |
26 | | - url: https://packages.sury.org/php/apt.gpg |
27 | | - id: 15058500A0235D97F5D10063B188E2B695BD4743 |
28 | | - state: present |
29 | | - when: ansible_distribution == "Debian" |
30 | 13 |
|
31 | | -- name: Add Ondrej Sury's repo (Debian). |
32 | | - apt_repository: |
33 | | - repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main" |
| 14 | +- name: Make API request to Launchpad |
| 15 | + uri: |
| 16 | + url: "https://api.launchpad.net/devel/~ondrej/+archive/ubuntu/php" |
| 17 | + return_content: yes |
| 18 | + method: GET |
| 19 | + headers: |
| 20 | + Accept: "application/json" |
| 21 | + register: launchpad_response |
| 22 | + |
| 23 | +- name: Parse JSON to extract signing key fingerprint |
| 24 | + ansible.builtin.set_fact: |
| 25 | + signing_key_fingerprint: "{{ launchpad_response.json.signing_key_fingerprint }}" |
| 26 | + |
| 27 | +- name: Add Ondrej's PHP PPA |
| 28 | + become: true |
| 29 | + ansible.builtin.deb822_repository: |
34 | 30 | state: present |
| 31 | + name: "ondrej-php-{{ ansible_distribution_release }}" |
| 32 | + types: [deb] |
| 33 | + uris: [https://ppa.launchpadcontent.net/ondrej/php/ubuntu] |
| 34 | + suites: ["{{ ansible_facts['distribution_release'] }}"] |
| 35 | + components: [main] |
| 36 | + signed_by: "{{ signing_key_fingerprint }}" |
35 | 37 | register: php_ondrej_debian_repo |
36 | | - when: ansible_distribution == "Debian" |
37 | 38 |
|
38 | 39 | - name: Update apt caches after repo is added (Debian). |
39 | 40 | apt: update_cache=true |
|
0 commit comments