virter icon indicating copy to clipboard operation
virter copied to clipboard

[Feature Request] Support bind mounts in container provisioner

Open C-512L opened this issue 2 years ago • 2 comments

One use case mentioned in docs/provisioning.md for the container provisioner is using a external provisioning tool such as ansible but there is no way to pass configuration/secrets (such as inventories and playbooks) to the running container.

C-512L avatar Apr 11 '23 17:04 C-512L

Thanks for the suggestion. I can imagine there could be use cases for custom bind mounts.

there is no way to pass configuration/secrets (such as inventories and playbooks) to the running container

Note that:

In addition, every container binds the following paths:

  • The current working directory of Virter, exposed read only at /virter/workspace
  • The SSH private key Virter used to connect to the machine as root at /root/.ssh/id_rsa
  • The SSH known hosts file, prefilled for connecting to the machine at /root/.ssh/known_hosts

These bind mounts have so far been sufficient for provisioning with ansible. Virter is run from the directory containing the playbooks. The SSH key is the secret required for accessing the VMs. The TARGETS environment variable is used to construct the inventory.

There is some work to do to glue that all together. I'm afraid I'm not aware of a publicly available example of how to do it.

Is that sufficient in your case?

JoelColledge avatar Apr 12 '23 11:04 JoelColledge

Note that:

In addition, every container binds the following paths:

  • The current working directory of Virter, exposed read only at /virter/workspace
  • The SSH private key Virter used to connect to the machine as root at /root/.ssh/id_rsa
  • The SSH known hosts file, prefilled for connecting to the machine at /root/.ssh/known_hosts

Thanks for pointing me out about the /virter/workspace mount. I don't know how but i had missed that part in the docs. Still, I think it could be quite useful for some cases like adding upper/external directories or for caching temporal files. This issue can be left open as a possible future improvement.

C-512L avatar Apr 13 '23 05:04 C-512L