Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,4 @@ odoo_role_dev_helpers: true
# wkhtmltopdf version
wkhtmltox_version_jammy: "0.12.6.1-2"
wkhtmltox_version_bionic: "0.12.6-1"
wkhtmltox_version_nobel: "0.12.6-2build2"
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 %}"
wkhtmltox_version: "{% if ansible_distribution_release in ['jammy', 'bullseye'] %}{{ wkhtmltox_version_jammy }}{% else %}{{wkhtmltox_version_bionic}}{% endif %}"
14 changes: 3 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,9 @@
failed_when: false
changed_when: false

- name: Download and install wkhtmltopdf only if not already present at any version
apt:
deb: "https://github.com/wkhtmltopdf/packaging/releases/download/{{ wkhtmltox_version }}/wkhtmltox_{{ wkhtmltox_version }}.{{ ansible_distribution_release }}_amd64.deb"
when: wkhtmltox_installed.rc == 1 and ansible_distribution_version < "24.04"

- name: Install wkhtmltopdf only if not already present at any version
apt:
update_cache: true
pkg:
- "wkhtmltopdf={{ wkhtmltox_version }}"
when: wkhtmltox_installed.rc == 1 and ansible_distribution_version >= "24.04"
- import_tasks: wkhtmltopdf.yml
become: true
when: wkhtmltox_installed.rc == 1

- import_tasks: pyenv.yml
become: true
Expand Down
43 changes: 43 additions & 0 deletions tasks/wkhtmltopdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
- name: Download and install wkhtmltopdf only if not already present at any version
apt:
deb: "https://github.com/wkhtmltopdf/packaging/releases/download/{{ wkhtmltox_version }}/wkhtmltox_{{ wkhtmltox_version }}.{{ ansible_distribution_release }}_amd64.deb"
when: ansible_distribution_version < "24.04"

- block:
- name: Download wkhtmltox dependencies
ansible.builtin.get_url:
url: http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
dest: /tmp/libssl1.1_1.1.1f-1ubuntu2_amd64.deb

- name: Download wkhtmltox
ansible.builtin.get_url:
url: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
dest: /tmp/wkhtmltox_0.12.5-1.bionic_amd64.deb

- name: Install wkhtmltox dependencies
shell: set -o pipefail && dpkg -i /tmp/libssl1.1_1.1.1f-1ubuntu2_amd64.deb | grep 'install ok installed'
args:
executable: /bin/bash
failed_when: false
changed_when: false

- name: Install wkhtmltox
shell: set -o pipefail && dpkg -i /tmp/wkhtmltox_0.12.5-1.bionic_amd64.deb | grep 'install ok installed'
args:
executable: /bin/bash
failed_when: false
changed_when: false

- name: Copy wkhtmltoimage a /usr/bin
ansible.builtin.copy:
remote_src: yes
src: /usr/local/bin/wkhtmltoimage
dest: /usr/bin/wkhtmltoimage

- name: Copy wkhtmltopdf a /usr/bin
ansible.builtin.copy:
remote_src: yes
src: /usr/local/bin/wkhtmltopdf
dest: /usr/bin/wkhtmltopdf

when: ansible_distribution_version >= "24.04"