Repository: ansible-collections/community.general

Issue:
community.general.incus connection not working as inventory_hostname treated as litteral
### Summary

In my environment I am connecting to an incus server via a remote client on OSX.  Ansible, running on the OSX machine is utilizing roles, and gets the inventory_hostname from the filename under the host_vars directory.  I suspect this environment is causing inventory_hostname to be treated as a litteral.  A very similar bug was fixed community.general.lxd and be found here: https://github.com/ansible-collections/community.general/pull/4912

I have already implemented the solution and will submit a pull request.



### Issue Type

Bug Report

### Component Name

incus.py connection plugin

### Ansible Version

```console (paste below)
ansible [core 2.16.2]
  config file = /Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg
  configured module search path = ['/Users/travis/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/travis/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.11.7 (main, Dec  4 2023, 18:10:11) [Clang 15.0.0 (clang-1500.1.0.2.5)] (/opt/homebrew/opt/python@3.11/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

```


### Community.general Version

```console (paste below)
$ ansible-galaxy collection list community.general
# /Users/travis/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 8.2.0
```


### Configuration

```console (paste below)
$  ansible-config dump --only-changed
CONFIG_FILE() = /Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg
DEFAULT_HASH_BEHAVIOUR(/Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg) = merge
DEFAULT_HOST_LIST(/Users/travis/workspace//IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg) = ['/Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg) = ['/Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/inventory.ini']
EDITOR(env: EDITOR) = emacs
HOST_KEY_CHECKING(/Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg) = False

```


### OS / Environment

client: OSX
server: Ubuntu 22.04

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
# host_var file named IzumaMercury.yaml
ansible_connection: community.general.incus
ansible_user: root
ansible_become: no
ansible_incus_remote: IzumaExplorer
```


### Expected Results

ansible-playbook -i inventories/tests/moffett.yaml setup_izuma_networks_vm_controllers_workers.yml

PLAY [vm_controllers] ****************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************
ok: [IzumaMercury]


### Actual Results

```console (paste below)
ansible-playbook -i inventories/tests/moffett.yaml setup_izuma_networks_vm_controllers_workers.yml

PLAY [vm_controllers] ****************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************
[WARNING]: The "community.general.incus" connection plugin has an improperly configured remote target value, forcing
"inventory_hostname" templated value instead of the string
fatal: [IzumaMercury]: UNREACHABLE! => {"changed": false, "msg": "instance not found: inventory_hostname", "unreachable": true}
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:

Resolving patch:
diff --git a/plugins/connection/incus.py b/plugins/connection/incus.py
--- a/plugins/connection/incus.py
+++ b/plugins/connection/incus.py
@@ -21,6 +21,7 @@
             - The instance identifier.
         default: inventory_hostname
         vars:
+            - name: inventory_hostname
             - name: ansible_host
             - name: ansible_incus_host
       executable:


Test patch: