Being able to work on jails as an admin on the host system.
Exactly.
What I do is update my jail as a chroot. The jail itself doesn't have write privileges to the underlying directory tree. Some mountpoints are mounted read-only while others are layered underneath unionfs. The jail itself is just a read-only consumer of the beneath it. The layer underneath -- call it the source of truth for the jail -- is then updated as a chroot.
The rationale for this is should the jail become compromised the damage is limited to the unionfs layers on top of the "source of truth" and any data directories directly in the jail.
As to how I update it, I have an installworld script that installs world on the host itself, then the jails. WRT packages, they are built using poudriere. The update itself is done using the pkgng ansible module. A snippet of my pkg upgrade ansible is below:
Code:
### /jails/template
- name: Check for existence of jail template /sbin/init
stat:
path: /jails/template/root/sbin/init
register: stat_result
- name: Upgrade all packages in jail template
pkgng:
chroot: /jails/template/root
name: "*"
ignore_osver: true
autoremove: false
state: latest
when: stat_result.stat.exists
The ansible playbook updates all my machines at once, each machine has an amd64 partition and i386 partition, except for the exterior gateway which has two amd64 partitions and a jail template.
Now the reason for calling the stat module is that this same playbook is run on all my machines but only one has /jails/template/root. The jail will mount /jails/template/root as /jails/external/root via read-only nullfs and with its own /etc plus bits and pieces of /var and its own data mounted using r/w nullfs on top of that. This allows the jail template update to happen on that machine and not others (because there is no jail template on the others).
The template itself could conceivably be used as a basis for multiple jails. For example, different nginx jail instances. Minimizing the number of copies of the same software on the same machine. When the jail template is updated, all the jails are updated simultaneously.