vscode-ansible
vscode-ansible copied to clipboard
Mounting local volume is not working when using Execution Environment
Summary
Using a local volume by providing its name like documented in https://github.com/ansible/vscode-ansible/tree/main#configuration is not possible.
This code https://github.com/ansible/vscode-ansible/blob/main/packages/ansible-language-server/src/services/executionEnvironment.ts#L224-L229 only checks if path exists in filesystem.
Would it be possible to improve this code ? Maybe by checking first with volume inspect ${mountPath}.
Extension version
24.8.4
VS Code version
1.92.2
Ansible Version
$ docker run --rm -it ansible-ee:2.16-dev ansible --version
ansible [core 2.16.10]
config file = None
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.12/site-packages/ansible
ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.12.3 (main, Aug 23 2024, 06:10:48) [GCC 13.2.1 20240309] (/usr/bin/python3)
jinja version = 3.1.4
libyaml = True
OS / Environment
Ubuntu 24.04 using a custom Execution Environment image (ansible-ee:2.16-dev)
Using these workspace settings :
"ansible.executionEnvironment.enabled": true,
"ansible.executionEnvironment.containerEngine": "docker",
"ansible.executionEnvironment.image": "ansible-ee:2.16-dev",
"ansible.executionEnvironment.pull.policy": "tag",
"ansible.executionEnvironment.containerOptions": "--network host",
"ansible.executionEnvironment.volumeMounts": [
{
"src": "ansible-roles",
"dest": "/home/ansible/.ansible/roles"
}
],
Relevant log output
[Error - 4:28:54 PM] Volume mount source path 'ansible-roles' does not exist. Ignoring this volume mount entry.
Experiencing the same issue I believe
vs code config
"ansible.executionEnvironment.volumeMounts": [
{
"src": "~/.ansible/collections/ansible_collections",
"dest": "/usr/share/ansible/collections/ansible_collections",
"options": "z"
}
]
Params: {
"type": 1,
"message": "Volume mount source path '~/.ansible/collections/ansible_collections' does not exist. Ignoring this volume mount entry."
}