Skip to content

Commit 09b2bc7

Browse files
authored
Merge pull request #168 from coopdevs/fix/wkhtmltopdf-ubuntu-24
wkhtmltopdf upg to Ubuntu 24
2 parents 288a3e1 + de793dc commit 09b2bc7

File tree

3 files changed

+47
-13
lines changed

3 files changed

+47
-13
lines changed

defaults/main.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,4 @@ odoo_role_dev_helpers: true
120120
# wkhtmltopdf version
121121
wkhtmltox_version_jammy: "0.12.6.1-2"
122122
wkhtmltox_version_bionic: "0.12.6-1"
123-
wkhtmltox_version_nobel: "0.12.6-2build2"
124-
wkhtmltox_version: "{% if ansible_distribution_release in ['jammy', 'bullseye'] %}{{ wkhtmltox_version_jammy }}{% elif ansible_distribution_release == 'bionic' %}{{wkhtmltox_version_bionic}}{% else %}{{ wkhtmltox_version_nobel }}{% endif %}"
123+
wkhtmltox_version: "{% if ansible_distribution_release in ['jammy', 'bullseye'] %}{{ wkhtmltox_version_jammy }}{% else %}{{wkhtmltox_version_bionic}}{% endif %}"

tasks/main.yml

+3-11
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,9 @@
4141
failed_when: false
4242
changed_when: false
4343

44-
- name: Download and install wkhtmltopdf only if not already present at any version
45-
apt:
46-
deb: "https://github.com/wkhtmltopdf/packaging/releases/download/{{ wkhtmltox_version }}/wkhtmltox_{{ wkhtmltox_version }}.{{ ansible_distribution_release }}_amd64.deb"
47-
when: wkhtmltox_installed.rc == 1 and ansible_distribution_version < "24.04"
48-
49-
- name: Install wkhtmltopdf only if not already present at any version
50-
apt:
51-
update_cache: true
52-
pkg:
53-
- "wkhtmltopdf={{ wkhtmltox_version }}"
54-
when: wkhtmltox_installed.rc == 1 and ansible_distribution_version >= "24.04"
44+
- import_tasks: wkhtmltopdf.yml
45+
become: true
46+
when: wkhtmltox_installed.rc == 1
5547

5648
- import_tasks: pyenv.yml
5749
become: true

tasks/wkhtmltopdf.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
- name: Download and install wkhtmltopdf only if not already present at any version
2+
apt:
3+
deb: "https://github.com/wkhtmltopdf/packaging/releases/download/{{ wkhtmltox_version }}/wkhtmltox_{{ wkhtmltox_version }}.{{ ansible_distribution_release }}_amd64.deb"
4+
when: ansible_distribution_version < "24.04"
5+
6+
- block:
7+
- name: Download wkhtmltox dependencies
8+
ansible.builtin.get_url:
9+
url: http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
10+
dest: /tmp/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
11+
12+
- name: Download wkhtmltox
13+
ansible.builtin.get_url:
14+
url: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
15+
dest: /tmp/wkhtmltox_0.12.5-1.bionic_amd64.deb
16+
17+
- name: Install wkhtmltox dependencies
18+
shell: set -o pipefail && dpkg -i /tmp/libssl1.1_1.1.1f-1ubuntu2_amd64.deb | grep 'install ok installed'
19+
args:
20+
executable: /bin/bash
21+
failed_when: false
22+
changed_when: false
23+
24+
- name: Install wkhtmltox
25+
shell: set -o pipefail && dpkg -i /tmp/wkhtmltox_0.12.5-1.bionic_amd64.deb | grep 'install ok installed'
26+
args:
27+
executable: /bin/bash
28+
failed_when: false
29+
changed_when: false
30+
31+
- name: Copy wkhtmltoimage a /usr/bin
32+
ansible.builtin.copy:
33+
remote_src: yes
34+
src: /usr/local/bin/wkhtmltoimage
35+
dest: /usr/bin/wkhtmltoimage
36+
37+
- name: Copy wkhtmltopdf a /usr/bin
38+
ansible.builtin.copy:
39+
remote_src: yes
40+
src: /usr/local/bin/wkhtmltopdf
41+
dest: /usr/bin/wkhtmltopdf
42+
43+
when: ansible_distribution_version >= "24.04"

0 commit comments

Comments
 (0)