From 52fcb77185483b014155dfa296bf46896523e303 Mon Sep 17 00:00:00 2001 From: Thomas Schulze Date: Fri, 23 Feb 2024 08:45:11 +0100 Subject: [PATCH] migrate to ansible --- roles/mozjpeg/files/installer.sh | 14 +++++++++++ roles/mozjpeg/tasks/main.yaml | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 roles/mozjpeg/files/installer.sh create mode 100644 roles/mozjpeg/tasks/main.yaml diff --git a/roles/mozjpeg/files/installer.sh b/roles/mozjpeg/files/installer.sh new file mode 100644 index 0000000..38e7581 --- /dev/null +++ b/roles/mozjpeg/files/installer.sh @@ -0,0 +1,14 @@ +VERSION="4.1.1" + +cd /tmp +wget https://github.com/mozilla/mozjpeg/archive/refs/tags/v${VERSION}.tar.gz -O mozjpeg.tar.gz +tar xvzf mozjpeg.tar.gz +cd mozjpeg-${VERSION} +mkdir build +cd build +sudo cmake -G"Unix Makefiles" -DPNG_SUPPORTED=OFF ../ +make install +make deb +sudo dpkg -i mozjpeg_*.deb +sudo ln -s /opt/mozjpeg/bin/cjpeg /usr/bin/cjpeg +sudo ln -s /opt/mozjpeg/bin/jpegtran /usr/bin/jpegtran diff --git a/roles/mozjpeg/tasks/main.yaml b/roles/mozjpeg/tasks/main.yaml new file mode 100644 index 0000000..fa1e629 --- /dev/null +++ b/roles/mozjpeg/tasks/main.yaml @@ -0,0 +1,41 @@ +--- + +# Build and install mozjpeg + +- name: Install build packages for mozjpeg + ansible.builtin.apt: + name: + - cmake + - autoconf + - automake + - libtool + - nasm + - make + - pkg-config + +- name: Copy install script + ansible.builtin.copy: + src: installer.sh + dest: /tmp/installer.sh + owner: root + group: root + mode: '0755' + +- name: Build and install mozjpeg + ansible.builtin.command: + cmd: /tmp/installer.sh + chdir: /tmp + changed_when: true + +- name: Remove build packages + ansible.builtin.apt: + name: + - cmake + - autoconf + - automake + - libtool + - nasm + - make + - pkg-config + state: absent + autoremove: true