Are there any working examples of using community.general.jail

We have several freebsd jails that do not have ssh connectivity.
Can we use the jail connection the same way that we use the lxd one.
I have root connectivity on the jail hosts but the connection doesn’t work the same way.

On my lxd hosts I use an inventory file like this.

[containers:children]
local_containers
remote_containers
[containers:vars]
ansible_connection=lxd

[local_containers]
jules    ip_address=198.202.31.135 purpose="Squid Server"
...
[remote_containers]
teddy    ip_address=198.202.31.132 purpose="Secondary DNS"        ansible_host=aoc2024:teddy

And everything just works.

I have not figured out how to make the jail connection work in the same way.

I’ve not used the community.general.jail connection however if it works like the community.general.chroot connection where the Ansible playbook needs to be run on the same host that the chroot exists on, it can’t be run via SSH, perhaps this is also the case for community.general.jail? :man_shrugging:

An example YAML inventory file (sorry I don’t have an example in the INI format) for use with community.general.chroot, note that the inventory_hostname is the path to the directory for the chroot:

---
all:
  children:
    chroots:
      vars:
        ansible_connection: community.general.chroot
      hosts:
        /chroot:
    localhosts:
      vars:
        ansible_connection: local
      hosts:
        localhost:
...

For reasons I’ve not worked out the Implicit ‘localhost’ feature hasn’t been working for me recently without is also being added to the inventory.

2 Likes