Can't install / find Ansible community.general.incus

Following the directions at community.general.incus connection – Run tasks in Incus instances via the Incus CLI. — Ansible Community Documentation

root@tk2022:~# ansible-galaxy collection download community.general
Process download dependency map
Starting collection download process to '/root/collections'
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-general-10.1.0.tar.gz to /root/.ansible/tmp/ansible-local-1071507j1m8xewx/tmpaasilbyr/community-general-10.1.0-q6b40knk
Downloading collection 'community.general:10.1.0' to '/root/collections'
Collection 'community.general:10.1.0' was downloaded successfully
Writing requirements.yml file of downloaded collections to '/root/collections/requirements.yml'
root@tk2022:~# ansible pets -m ping
jules | FAILED! => {
    "msg": "the connection plugin 'incus' was not found"
}
...

Could you try: ansible-galaxy collection install community.general?

Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.

I also did the --force same result

So yeah installing community.general did not include incus. Is there a way to install the incus by itself. I only use ansible to create new containers. (which I would like to do)

I think you have a misconfigurationed system. I just spun up a new Debian Bookworm instance and installed Ansible with apt-get.

Then I ran the install command I posted earlier.

I now have the Incus connector installed at ~/.ansible/collections/ansible_collections/community/general/plugins/connection/incus.py

It looks like you are installing collections to /root/collections. Maybe you can find it under a similar path as mine. I suspect that your Ansilbe install is not picking up the correct path.

Any chance you can run Ansible from a Debian container like I did? What system are you trying to run Ansible from?

I am running incus on a debian bookworm. I hadn’t noticed the /root/collections part I will dig a little deeper. Thank you!

I have similar issue. ansible just does not see incus connection plugin:

$ ansible-doc -t connection -l | grep --count incus
0

Though I have the file at ~/.local/lib/python3.10/site-packages/ansible_collections/community/general/plugins/connection/incus.py

I suspect this is because python 3.10 is too old. In another environment with python 3.11 ansible can recognize incus connection plugin.

Thanks for the extra bit of information.

In this case, you can use pyenv. :slight_smile: It works well for me.

Actually you are right it is installed but not picking it up.

Figured it out.
The old inventory file had the “ansible_connection=lxd” for containers and I tried to just replace lxd with “ansible_connection=incus”. The snippet below works.

[containers:vars]
#ansible_connection=lxd
ansible_connection=community.general.incus
1 Like