How to manage services in FreeBSD jails with Ansible

Ansible modules made for FreeBSD usually have a ‘jail’ argument, for example to set RC arguments in a jail, or to install a package with pkg. The service module, however, does not. Luckily, I discovered a method that lets you do just that, without reinventing the wheel! This method works only if you run Ansible ≥ 2.18.1. If you don’t, I also discovered a hack that works around this version…