Ansible add pecl or pear extensions

Trellis is working out great but I’m having trouble with understanding where to add configuration for enabling yaml-php during server setup. I’m kind of muddling through this the best I can with very little knoweledge of vagrant or ansible, but wondering if someone could give an example of further configuring the setup of the environments that would be awesome.

You can just add it here: https://github.com/roots/trellis/blob/ad8910b1c80f2782e1b9fcf336f5e07d6759129b/roles/php/tasks/main.yml#L25

And then re-provision the server as usual.

I think it requires a bit more work than that. The yaml extension first requires libYAML to be installed. Also, I only see php extensions in the yaml list that come prepackaged with php, whereas php yaml is not - it’s a pecl extension. I could be wrong here…but I tried php7.1-yaml and no dice.

Then you’d need to also add libyaml-dev with a task like this:

- name: Install libyaml
   apt:
     name: libyaml-dev

Or you could use a pure PHP YAML package: https://github.com/mustangostang/spyc

That way you don’t need to edit anything in Trellis. Just use that as a Composer dependency