Provisioning with optipng, gifsicle and libjpeg-progs


I’m experimenting with the EWWW Image Optimize plugin on a Trellis site. With a freshly provisioned Vagrant machine, I get warnings that optipng, gifsicle and jpegtran are not found when running a WordPress XML import.

The warnings go away after installing the respective Apt packages:

sudo apt-get install optipng gifsicle libjpeg-progs

I’m new to Ansible and want to install the Apt packages automatically. I haven’t been able to find any Ansible packages to install any of these tools (like bedrock-site-protect). Is there a recommended way to install Apt packages? Would I need to create my own Ansible playbook?

1 Like

In main.yml just specify apt_packages_custom

  - optipng
  - gifsicle
  - libjpeg-progs

Thank you, @QWp6t! That is exactly what I needed!

I’d like to add custom APT packages on the current (December 2018) version of Trellis. I am getting an error that these need to be specified in “dict” format and a reference to:

I am getting confused about how to format the dependency. The apt package I would like to add is python-passlib. Is there more documentation for this available somewhere?

Found out what my mistake was. I was using this syntax:

  - python3-passlib

Managed to get things to work using the following:

  python3-passlib: present

Hope this helps someone.


I went with this format to match the other declarations in main.yml:

  sox: "{{ apt_package_state }}"
  libsox-fmt-all: "{{ apt_package_state }}"
  php-gd: "{{ apt_package_state }}"

No idea what apt_package_state is referring to.

apt_package_state is defined at group_vars/all/main.yml:

apt_package_state and alike let you control whether you want to update the apt packages.
See: for possible options.

1 Like

@TangRufus Thanks for this. I’m curious now.

More reading here: